Nik*_*sen 17 android listview android-layout
我有一个向上扩展而不是向下扩展的listView.我在另一个页面上有另一个listView,它运行得很好并从顶部填充自己 - > bot.为什么我的listView从底部开始而不是从顶部开始?
我的XML`
<ListView
android:id="@+id/list_view_showRegister"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/showRegister"
android:layout_alignParentLeft="true"
android:layout_marginTop="50dp"
android:clickable="false" >
</ListView>`
Run Code Online (Sandbox Code Playgroud)
Mik*_*ter 28
你ListView实际上仍然从顶部向下填充.只是不是从页面的顶部.
你已经设置了layout_height="wrap_content"和layout_above="@+id/showRegister".在高度为的情况下wrap_content,视图将仅与其内容一样大.然后,由于您使用的事实layout_above,它将直接在另一个视图上方.
列表视图不是从底部填充,而是从列表视图的顶部填充 - 但列表视图本身仅从屏幕的中间开始.列表视图上方的任何内容实际上并不是列表视图的一部分,而是空白空间.
解决方案是设置layout_height="match_parent"或删除layout_above标签.
我知道这是一个老问题,但我希望这可以帮助其他任何可能通过谷歌找到这个问题的人.
| 归档时间: |
|
| 查看次数: |
17858 次 |
| 最近记录: |