Make buttonsize bigger for tablet? Android, Xml
- by Cornelia G
I have a android view with 2 buttons centered. I want to change the button sizes to be bigger when I run the app on a tablet because they look ridiculous small there since it is the same size as for the phones.
How can I do this?
This is my code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#e9e9e9"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin" >
<ImageView android:id="@+id/imageView1"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
android_layout_gravity= "center"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp"
android:src="@drawable/icon_bakgrund_android">
</ImageView>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/TableLayout01"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_centerInParent="true"
>
<TableRow android:id="@+id/TableRow01"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<Button
android:id="@+id/button1"
android:layout_width="260dp"
android:layout_height="50dp"
android:background="@drawable/nybutton"
android:layout_below="@+id/button2"
android:text="@string/las_sollefteabladet"
android:textColor="#ffffff"
android:layout_centerHorizontal="true"/>
</TableRow>
<TableRow android:id="@+id/TableRow02" android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="centerCrop">
<Button
android:id="@+id/button2"
android:layout_width="260dp"
android:layout_height="50dp"
android:layout_marginTop="10dp"
android:background="@drawable/nybutton"
android:layout_centerInParent="true"
android:text="@string/annonsorer"
android:textColor="#ffffff"
/>
</TableRow>
</TableLayout>
</RelativeLayout>
</RelativeLayout>