0

linearLayout の 2 つの子の間にギャップを作成したいと考えています。

適切にスケーリングされないため、マージンやパディングを使用したくない

風景に切り替えると。

私は重量を使用する方が好きです。しかし、それらの間にダミーの (ギャップのみの) ビューを作成する方法は?

ところで、ランドスケープ xml を作成しないとどうなりますか?

デバイスの向きを縦から横に変更しますか?

更新 1

私が試してみました:

<LinearLayout
    android:id="@+id/layout_information"
    android:layout_width="0dp"
    android:layout_height="fill_parent"
    android:layout_weight="0.47"
    android:orientation="vertical" 
    android:gravity="center"
    >

    <TextView
        android:id="@+id/text_view_destination"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="\@ Home in"
        android:textColor="@color/solid_white"
        android:textSize="19sp"
        android:textStyle="bold" />

    <View
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_weight="0.2"/>

    <TextView
        android:id="@+id/text_view_time"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingLeft="40dp"
        android:textColor="@color/solid_white"
        android:textSize="25sp"
        android:textStyle="normal" />
</LinearLayout>

しかしその後

ネストされた重み付けのパフォーマンスに関する警告が表示されます。

ガジェットの描画時にランタイム エラーが発生する

4

1 に答える 1

0

ICS 以上用にビルドする場合は、Spaceウィジェットを使用します。

<Space
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="YourWeight"/>

( http://developer.android.com/reference/android/widget/Space.html )

それ以外の場合は、空のView.

RelativeLayoutあなたの場合、 a を使用する方がより効率的かどうかを検討することもできます。

デバイスが回転していて、横向き専用のレイアウトがない場合は、縦向きが使用されます。

于 2013-07-28T11:50:59.343 に答える