Reputation: 3327
I have RelativeLayout with RelativeLayout title bar:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_horizontal"
android:orientation="vertical" >
<RelativeLayout android:id="@+id/titleBar"
style="@style/TitleBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true">
<TextView
android:id="@+id/caption"
style="@style/WindowCaption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="caption"/>
<Button
android:id="@+id/buttonSave"
style="@style/ButtonBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="5dp"
android:onClick="save"
android:text="Save" />
</RelativeLayout>
...
</RelativeLayout>
On a small screens the button gets on top of the text:
I want to resize text, or button to make all of them properly visible. And I want the text was is on the centre.
Can I do it somehow using only style and layout tools?
Or the only way is to programmatically change the text size?
Upvotes: 1
Views: 3908
Reputation: 321
<RelativeLayout
android:id="@+id/te1"
android:layout_width="fill_parent"
android:layout_height="45dp" >
<TextView
android:id="@+id/TextViewCount"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/ButtonCount"
android:layout_alignParentLeft="true"
android:layout_toLeftOf="@+id/ButtonCount"
android:text="Countfdddgd "
android:textSize="40dip" />
<Button
android:id="@+id/button1"
style="@style/ButtonText"
android:layout_alignParentRight="true"
android:layout_marginTop="2dp"
android:background="@drawable/greenbutton"
android:height="45dp"
android:text="Accounts"
android:width="100dp" />
</RelativeLayout>
Upvotes: 1