gpt4 book ai didi

android - ScrollView 不显示内容

转载 作者:太空宇宙 更新时间:2023-11-03 12:58:07 28 4
gpt4 key购买 nike

有人能解释一下为什么 ScrollView 不显示他的子元素吗?我在线性布局垂直内有很多 TextView ,线性布局在 ScrollView 内......

但我没有看到任何 ScrollView 和 TextView ..

这是 XML 布局

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<TextView
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/scrollViewCheck"
android:gravity="center"
android:padding="10dip"
android:text="Pick which items you want to count"
android:textAppearance="?android:attr/textAppearanceMedium" >
</TextView>

<ScrollView
android:id="@id/scrollViewCheck"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/bottomSettings"
android:scrollbarFadeDuration="0" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical" >

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="Test"
android:textAppearance="?android:attr/textAppearanceMedium" />
</LinearLayout>
</ScrollView>

<RelativeLayout
android:id="@id/bottomSettings"
android:layout_width="fill_parent"
android:layout_height="wrap_content" >

<Button
android:id="@+id/timeButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Choose Count Time" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/timeButton"
android:orientation="horizontal" >

<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Back" />

<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Start" />
</LinearLayout>
</RelativeLayout>

</RelativeLayout>

提前致谢;)

最佳答案

View 的问题与底部的 RelativeLayout 有关。这应该可以解决您的问题。将底部的 RelativeLayout 替换为:

 <LinearLayout
android:id="@+id/bottomSettings"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true">

<Button
android:id="@+id/timeButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Choose Count Time" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/timeButton"
android:orientation="horizontal" >

<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Back" />

<Button
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="Start" />

</LinearLayout>

</LinearLayout>

关于android - ScrollView 不显示内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16156525/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com