2011-05-16 47 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