0

私は次の構造を持っています:

<LinearLayout
    android:id="@+id/linearLayout5"
    android:layout_width="match_parent"
    android:layout_height="0dip"
    android:background="@drawable/framewhite"
    android:orientation="vertical" 
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:layout_weight="1"
    android:gravity="right"
    >


    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="120dp"
        android:layout_marginTop="20dp"
        android:layout_marginLeft="20dp"
        android:layout_marginRight="20dp"
        >

       <TextView
            android:id="@+id/txtBestPickTrivia"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/testTrivia"
            android:textAppearance="?android:attr/textAppearanceMedium" />


    </ScrollView>

    <TextView
        android:id="@+id/txtEntityName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="2dp"
        android:layout_marginBottom="10dp"
        android:layout_marginRight="20dp"
        android:text="Cars (2006)" />

</LinearLayout>

ScrollView の次の行で問題が発生します。

android:layout_height="120dp"

画面の解像度に応じて高さを調整したいのですが、HTC Desire で正常に動作する3.7 インチ WVGA (Nexus One)を使用して設計しましたが、 3.2 HVGAを使用する HTC Explorer を使用してアプリをテストしたところ、動作しませんでした。ScrollView が画面の境界を越えてしまい、TextView、つまり txtEntityName が表示されません。

もう1つ、コントロールを上、下、右、または左にドッキングできる.NETのように、任意のコントロールをドッキングできる方法はありますか?

4

4 に答える 4

0

画面の質問については、http://developer.android.com/guide/practices/screens_support.html を確認してください

于 2012-07-19T15:48:56.717 に答える
0

android:gravity「ドッキング」に関しては、および/または絶対配置プロパティ (つまり、alignParentTop)を使用できます。

于 2012-07-19T15:49:34.733 に答える
0

LinearLayout の代わりに RelativeLayout を使用し、txtEntityName を下に、ScrollView を親の上に、その下を txtEntityName の上に配置する必要があります。ScrollView の layout_height を 0dp に設定します

于 2012-07-19T15:52:15.277 に答える