raz*_*zor 5 android android-layout android-listview
我想在顶部(标题)制作带有TextView的屏幕,中间是ListView,底部是按钮.如何放置ListView,将填充顶部TextView和底部按钮之间的整个空间,并能够滚动其内容?
现在,当我的列表增长时,它会按下屏幕外的底部按钮.
我有:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<Button android:id="@+id/button1"
android:layout_height="wrap_content"
android:text="Button"
android:layout_width="wrap_content"
/>
<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"
android:layout_alignParentBottom="true"
/>
<ListView android:id="@+id/lvLocations"
android:layout_width="match_parent"
android:layout_height="wrap_content"
/>
<TextView android:layout_height="0dip"
android:layout_width="fill_parent"
android:layout_weight="1"
/>
<Button android:text="LayerDrawable"
android:id="@+id/button5"
android:textSize="15dp"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:background="@drawable/layer_drawable"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
最后一个TextView用于形成间隙并移动Button到底部.
Ron*_*nie 13
用一个LinearLayout.设置layout_weight="1"为你ListView的layout_height="fill_parent".去除其他元素的重量.
<ListView android:id="@+id/lvLocations"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
></ListView>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9439 次 |
| 最近记录: |