多くのアイテムを含む垂直スクロール可能なレイアウトがあり、正常に動作しています。
スクロール可能なレイアウトの一部ではない新しい線形レイアウトを画面の下部に配置しようとしています。
つまり、スクロール可能な部分とは関係なく、(広告ビューのように) ボタンに配置されます。scrollView 内にしか配置できませんでした。常に表示
されるように、下に配置するにはどうすればよいですか?
5594 次
4 に答える
20
RelativeLayout を使用して、次のように整理します。
<?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"
android:orientation="vertical" >
<ScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
android:layout_above="@+id/linearLayoutThatDoesNotScroll" >
<LinearLayout
android:id="@+id/linearLayoutWithLotofContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
</LinearLayout>
</ScrollView>
<LinearLayout
android:id="@+id/linearLayoutThatDoesNotScroll"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true" >
</LinearLayout>
</RelativeLayout>
トリックは、ScrollView の配置にあります。同時に、画面の上部に配置され、下部の固定された LinearLayout の上に配置されます。それだけで機能します。
于 2011-11-30T14:39:02.357 に答える
5
このようなもの :)
<?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" >
<ScrollView android:id="@+id/scroll_view"
android:layout_width="fill_parent"
android:layout_height="0dp"
android:layout_weight="1" >
<LinearLayout android:id="@+id/content"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</ScrollView>
<LinearLayout android:id="@+id/bottom"
android:layout_width="fill_parent"
android:layout_height="10dip" />
</LinearLayout>
Android:id=bottom を使用して、下部のコンテンツを下部のlinearLayoutに追加します:)
于 2011-11-30T14:29:49.940 に答える
1
スクロール可能なレイアウトを保持するために垂直を使用した場合LinearLayout
、adview をLinearLayout
スクロール可能なレイアウトの下に追加すると、画面の下部に表示されます。(重みが正しく設定され、スクロール レイアウトが に設定されていると仮定しますWRAP_CONTENT
)
ARelativeLayout
を使用すると、adview をスクロール可能なレイアウトの下部に合わせて配置することもできますが、スクロール可能なレイアウトがWRAP_CONTENT
自動的に画面全体を占有しないように設定されていることを確認する必要があります。
于 2011-11-30T14:27:46.320 に答える
1
<?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" >
<Button
android:id="@+id/dialogButtonOK"
android:layout_width="100px"
android:layout_height="wrap_content"
android:text=" Ok "
android:layout_alignParentBottom="true"
android:layout_centerInParent="true"
android:background="@drawable/button_style"
/>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="5dp"
android:id="@+id/scrView"
android:layout_above="@id/dialogButtonOK"
android:layout_alignParentTop="true"
>
<HorizontalScrollView
android:layout_width="fill_parent"
android:layout_height="wrap_content" >
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:stretchColumns="*"
android:id="@+id/main_table" >
</TableLayout>
</HorizontalScrollView>
</ScrollView>
</RelativeLayout>
これは私のために働いています
于 2015-08-02T12:39:00.203 に答える