如何修复嵌套在ScrollView中的BoxInsetLayout中的包装元素

问题描述 投票:1回答:1

我想要从顶部和侧面装箱子的可滚动BoxInsetlayout。在ScrollView嵌套的BoxInsetLayout的子项中包装组件似乎是错误的。这是因为BoxInsentLayout无法为wrap-content设置吗?

这是我的例子:

<?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>

结果: result

期望: ![expectiation](https://ibb.co/vjPPmZR)

android android-layout user-interface scroll wear-os
1个回答
0
投票

解决方案是添加:android:fillViewport="true"

© www.soinside.com 2019 - 2024. All rights reserved.