android - 如何修复嵌套在 ScrollView 中的 BoxInsetLayout 内的包装元素
问题描述
我想实现可滚动的 BoxInsetlayout,子元素从顶部和侧面装箱。在 ScrollView 嵌套的 BoxInsetLayout 的子项中包装组件似乎有问题。这是因为不能为 wrap-content 设置 BoxInsentLayout 吗?
这是我的例子:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"
tools:deviceIds="wear">
<android.support.wear.widget.BoxInsetLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical"
app:boxedEdges="left|top|right" >
<TextView
android:id="@+id/text_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/hello_world"
android:textAlignment="center"
android:textColor="@color/black"
android:visibility="visible" />
</LinearLayout>
</android.support.wear.widget.BoxInsetLayout>
</ScrollView>
解决方案
解决方案是添加:android:fillViewport="true"
.
推荐阅读
- javascript - 使用 webpack 访问 index.html 中的环境变量
- javascript - 如何使 Chrome 扩展 div 全屏显示?
- excel - 如何从Excel中的两列中识别不同的记录
- javascript - 滚动时仅触发一次
- ios - 使用 SwiftUI 将单个引脚添加到 Mapkit
- python-3.6 - 将txt文件合并为一个,保留不同文件中重复项的最新行
- elasticsearch - elsaticsearch 中的源过滤、存储字段和文档值有什么区别?
- python - 如何在 python 中的文本预处理期间保留十进制数字?(已编辑)
- javascript - 如果它们的长度小于某个数字,如何从 React 中的数组中过滤项目?
- mysql - 如何在 MySQL 中使用 Fluent Migrator 自动生成 UUID/GUID?