0

2 つの子を持つ relativeLayout があります。2 つのテキストビューが上下に並んでいます。高さのルールとしてrelativeLayout持っています。wrap_content

現在、これrelative_layoutには背景がある800x500ため、この500高さピクセルを高さとして使用します。150dp必要以上のスペースを無駄にすることなく、2つのテキストビューに対応する高さのルールのようなものを与えて、それをトリミングする必要があります。

その背景をどのように使用できrelativeLayoutますwrap_contentか?

 <RelativeLayout
        android:id="@+id/mid"
        android:layout_below="@id/top"
        android:layout_width="wrap_content"
        android:layout_height="130dp" /*if i have wrap_content here it take 500px as height */
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="5dp"
        android:paddingLeft="10dp"
        android:background="@drawable/counter_background2" // 800x500>

            <TextView
                android:id="@+id/CounterMechanicsTitle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_marginTop="10dp"
                android:textSize="30dp"
                android:text="@string/mechanics" />

            <TextView
                android:id="@+id/CounterMechanics"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_below="@id/CounterMechanicsTitle"
                android:layout_marginTop="5dp"
                android:textSize="20dp"
                android:text="@string/mechanics" />

        </RelativeLayout>
4

1 に答える 1