2

Android レイアウトの設定に問題があります。

私が望むは、スクロール可能な ListView の後に、スクロールせず、常に画面の下部にとどまる小さなテキスト バー (TextView) が続くことです。

次のようになります。

ListViewItem1

ListViewItem2

ListViewItem3

…</p>

ここにテキスト バー (ListView のスクロール状態に関係なく常に表示されます)

これについてさまざまなバリエーションを試しましたが、静的テキストを表示するものはありません

どこが間違っているかについて何か考えはありますか?

TKS!

<?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">
    <LinearLayout android:orientation="vertical"
        android:layout_width="fill_parent" android:layout_height="wrap_content">
        <ListView android:id="@+id/list2" android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>
    <TextView android:layout_width="fill_parent"
        android:layout_height="50dip" android:text="Bar of text that always stays at the bottom of the screen" />
</LinearLayout>
4

5 に答える 5

3

を使用しRelativeLayoutます。TextViewを使用して を下に固定しますandroid:layout_alignParentBottom="true"。残りをListView埋めてもらいます。

または、単一の を使用し、をとに設定LinearLayoutし、次を の子として設定します。ListViewandroid:layout_height0pxandroid:layout_weight1TextViewListViewLinearLayout

于 2009-12-03T17:51:02.887 に答える
1

android:layout_weight を使用して、静的テキストで使用されていないページの残りの部分をリストビューで埋めるようにします。

そのようです:

<?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">
    <LinearLayout android:orientation="vertical"
        android:layout_width="fill_parent" android:layout_height="wrap_content">
        <ListView android:id="@+id/list2" android:layout_width="fill_parent"
                android:layout_height="wrap_content" android:layout_weight="1"/><!-- here's the important part-->
    </LinearLayout>
    <TextView android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:text="Bar of text that always stays at the bottom of the screen" />
</LinearLayout>
于 2010-01-04T21:23:17.547 に答える
1

実際には、ListView がすでに持っていて、あなたが説明したことを正確に行うフッターを使用したいようです。

于 2010-06-04T18:18:51.900 に答える
0

@CommonsWareの回答に基づく:

<?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">

    <ListView android:id="@+id/actionsListView" 
        android:layout_height="0px" 
        android:layout_width="fill_parent"
        android:layout_weight="1"
        android:transcriptMode="alwaysScroll"/>    

    <TextView android:text="" 
        android:id="@+id/progressTextLabel" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content"
        android:singleLine="true"/>

</LinearLayout>
于 2011-07-12T06:47:29.687 に答える
0

これを試してください:

それが役に立てば幸い:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="420dp"
        android:id="@+id/rel">
        <ListView
            android:id="@+id/list2"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"/>
    </RelativeLayout>
    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/rel"
        android:layout_alignParentBottom="true">
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="50dip"
            android:text="Bar of text that always stays at the bottom of the screen" />
    </RelativeLayout>
</RelativeLayout>
于 2014-06-28T11:38:16.247 に答える