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>