TextViewを上に、ListViewを下に、TextViewを下に、どのように最後のTextViewを画面の下部に固定するか、ListViewを上部のtextViewと下部のTextViewの間に塗りつぶし、リストを持たない最後のTextViewを画面外に押しますか?listviewをテキストを押し下げるのを防ぐには?
0
A
答えて
3
(私が使用していたように)下に全体の相対的なレイアウトを取る
<RelativeLayout>
<LinearLayout>
<!-- All your other elements in here -->
</LinearLayout>
<TextView
android:layout_alignParentBottom="true" />
</RelativeLayout>
第二に、私は何をすべきかです。 (この例に続いて、もちろん、あなたのListViewでScrollViewを置き換えると思います。)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="My Header Text" />
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all. Lots of content that needs to be scrolled, to see it all." />
</ScrollView>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="My Footer Text" />
</LinearLayout>
そして、ここではそれが私のG2のようになります。
1
リストビューを保持する線形レイアウトをネストします。
1
リストビューではandroid:layout_weight="1"
、下部のTextViewではandroid:layout_weight="0"
が必要です。私はあなたの欲しいものに似たようなことを行います。
編集:実際には、ボトムのTextViewにネストされたLinearLayout android:layout_weight="0"
を置く必要があります。私はLLで囲まれたボトムバーを持っていますが、あなたのTextViewでlayout_weightを直接使用することができます
1
これは2通りの方法で実行できます。 まず、
LinearLayoutからTextViewを取り出し、LinearLayoutとTextViewをRelativeLayout内で結合します。 android:layout_alignParentBottom = "true"をTextViewに追加します。ここで
<RelativeLayout
android:id="@+id/InnerRelativeLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true">
<Button
android:text="@string/label_submit_button"
android:id="@+id/Button"
android:layout_alignParentRight="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/EditText"
android:layout_width="fill_parent"
android:layout_toLeftOf="@id/Button"
android:layout_height="wrap_content" />
</RelativeLayout>