在我的佈局中,我需要一個標題,一個列表視圖和一個包含TextView
的頁腳。 TextView
需要調整大小到5行。認爲Facebook聊天,在那裏你必須與你的朋友的名字,中間的內容窗格和樓下一個文本框的藍色標題,一種生長在您鍵入的東西在:使用2個調整大小視圖創建Android佈局
[header] a fragment that takes up about 50dp
[content]
[content]
[content]
[content] something like a ViewGroup with a ListView in it
[content]
[content]
[content]
[footer] a ViewGroup that contains an EditText and Buttons
我已經試過各種不同的佈局設置,但不能正確。頁腳佔用所有空間,或內容覆蓋頁腳。
這是我到目前爲止有:
<LinearLayout ...>
<!-- Slot to put Header fragment in -->
<FrameLayout
android:id="@+id/header"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Here's where the content goes. This is supposed to be a ListView
inserted as a fragment -->
<FrameLayout
android:id="@+id/content"
... />
<include
android:id="@+id/footer"
... />
</LinearLayout>
我離開了layout_width
和layout_height
值空,因爲我不知道如何設置他們。
最新通報 起初,我以爲這個問題是因爲我EditText
設置爲maxLines=5
和TextMultiline
,但我想用一個硬編碼的高度去除一切,但一個按鈕,插入還是覆蓋了一切。我也試着設置<footer below="content">
但隨後content
只是覆蓋footer
嗨..看我的答案,如果它可以幫助您 – Shruti
您是否至少嘗試過我的佈局文件?我真的懷疑它的行爲像你在問題中所說的那樣。 – Luksprog