2011-05-16 68 views
2

我有一个垂直方向的LinearLayout内的按钮。不知道为什么按钮不显示?按钮没有出现在我的线性布局

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"> 
<com.commonsware.cwac.tlv.TouchListView 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tlv="http://schemas.android.com/apk/res/org.stocktwits.activity" 

    android:id="@android:id/list" 
    android:layout_width="fill_parent" 
    android:drawSelectorOnTop="false" 
    tlv:normal_height="64dip" 
    tlv:grabber="@+id/icon" 
    tlv:remove_mode="slideRight" 
android:layout_height="wrap_content"/> 
<Button android:text="Button" android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content"></Button> 

</LinearLayout> 
+0

如果您取出(暂时)TouchListView,会出现吗? – 2011-05-16 17:52:36

+0

这是android:id =“@ android:id/list”是否正确?我认为正确的是android:id =“@ + id/list” – evilone 2011-05-16 17:55:34

+0

它出现在我拿出TouchListView的时候。或者,TouchListView也会出现,布局中没有按钮。 – 2011-05-16 19:21:11

回答

1

android:height="wrap_content"对于垂直滚动窗口小部件如ListView没有任何意义。使用android:layout_weight与您的LinearLayoutRelativeLayout可以实现您尝试实现的任何外观。

+0

你能举个例子吗?我试图指定按钮在相对布局中的列表下方,但没有运气。 – 2011-05-16 21:33:36

+0

@Sheehan Alam:http://stackoverflow.com/questions/5678284/button-below-a-list-not-showing – CommonsWare 2011-05-16 21:41:44

1

尝试添加以下内容到的LinearLayout:

android:layout_width="fill_parent" 
android:layout_height="fill_parent" 

我猜的布局只是没有显示?

+0

我尝试了fill_parent两个字段。没有运气。 – 2011-05-16 19:21:37