0

次のコードがあります:

<TextView
        android:id="@+id/textView3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView2"
        android:layout_below="@+id/editText1"
        android:layout_marginTop="30dp"
        android:text="@string/cm_diameter"
        android:textAppearance="?android:attr/textAppearanceSmall" />

    <TextView
        android:id="@+id/textView4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignLeft="@+id/textView3"
        android:layout_below="@+id/textView3"
        android:layout_marginTop="28dp"
        android:text="@string/from"
        android:textAppearance="?android:attr/textAppearanceSmall" />

私が使用しているパラメーターは、相対レイアウトに接続されています。

スクロール ビューを使用して、このテキスト ビュー (別のビューもあります) をラップしたいと思います。

私の画像は、スクロール ビュー (緑のビュー) と、スクロール ビューの下に別のコンテナー (黒のビュー) を示しています。どうすればこの結果を達成できますか?

スクロール ビューでライナー レイアウトを使用しようとしましたが、予想とは異なる結果になりました。

ここに画像の説明を入力

4

2 に答える 2

3

あなたが何 android:layout_marginTop を入れたのか正確にはわかりません。しかし、上記のデザインのように、このための簡単なレイアウトを作成しようとしましたが、うまくいくと思います。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"
    android:background="#ff00ff00" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:padding="10dip" >

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Calculation" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="30dip"
            android:text="Item1"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="30dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="60dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="60dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="60dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="60dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="60dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="60dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="60dip"
            android:text="Another text view for test"
            android:textAppearance="@android:style/TextAppearance.Large" />
    </LinearLayout>
</ScrollView>

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#ff000000"
    android:padding="20dip" >

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:text="Add parameter" />
</FrameLayout>

そうですか?

于 2013-08-17T04:39:46.270 に答える