在按键布局线性不显示 [英] Buttons not displaying in linear layout

查看:157
本文介绍了在按键布局线性不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好
我需要的是一个按钮,必须显示在底部,所以我的code作为

Hi all my need is that buttons must show at bottom, so my code as

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  android:padding="12dip">

  <ListView
      android:id="@+id/list_multiselectable"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="center_vertical">
  </ListView>
<LinearLayout android:orientation="horizontal"           

     android:background="@android:drawable/bottom_bar"
    android:paddingLeft="4.0dip" android:paddingTop="5.0dip"
    android:paddingRight="4.0dip" android:paddingBottom="1.0dip"
    android:layout_width="fill_parent" android:layout_height="wrap_content"
    android:layout_alignParentBottom="true">

    my buttons code here
</LinearLayout>
  </LinearLayout> 

但是,当在列表中的项目较少(直到列表视图的滚动条未启用),按钮是可见的,但是当在列表中的项目比较多,按钮是不可见的,虽然我滚动列表项,最后一排,但在最后按钮没有显示。我怎样才能解决这个问题。

But when items in list are less (until scroll bar of list view is not enable), Buttons are visible, but when items in list are more, buttons are not visible, although I scrolled list item to last row, but at last buttons are not displaying. How can I solve it.

感谢您!

推荐答案

的LinearLayout 是给的ListView 所有空间它需要的,因为它认为连续的儿童和没有考虑到那些随之而来。

LinearLayout is giving ListView all the space it needs, because it considers its children sequentially and doesn't take into account those that follow.

我的建议是使用RelativeLayout的。

My suggestion is to use RelativeLayout.

<RelativeLayout ...>
  <ListView ...
           android:id="@+id/list"
           android:layout_alignParentTop="true"/>
  <LinearLayout ...
           android:layout_below="@id/list"
           android:layout_alignParentBottom="true">
     ...buttons...
  </LinearLayout>
</RelativeLayout>

这篇关于在按键布局线性不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆