【发布时间】:2015-06-22 13:27:01
【问题描述】:
以下是正在使用的布局。单选按钮组是动态添加的。组中的单选按钮很少,单选按钮更多,并且一旦方向改变,一切都可以正常工作,并且期望看到垂直滚动条并且它不显示。
还有其他属性需要设置到 ListView 吗?
感谢指点。
如果它值得,它是这个问题的扩展RadioGroup and TextView in a RelativeLayout - RadioGroup is hiding TextView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ListView
android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height=“wrap_content” >
</ListView>
<TextView
android:id="@+id/sample"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginBottom="20dp"
android:layout_marginTop="20dp"
android:background="@color/black"
android:gravity="center"
android:text="@string/sample"
android:textColor="@color/white" />
<RadioGroup
android:id="@+id/radio_group"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:layout_below="@+id/sample”
android:orientation="vertical" >
</RadioGroup>
</RelativeLayout>
【问题讨论】:
-
您的列表视图中没有任何内容(至少不是我们在您的布局中看到的radiogroup),并且它的高度为 0。RadioGroup 本身不可滚动,如果您愿意,请将其放入 ScrollView让它变得简单。