<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<Button
android:id="@+id/bb"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/bb"
android:drawablePadding="5dp"
android:text="bb" />
<Button
android:id="@+id/cc"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/bb"
android:drawableLeft="@drawable/cc"
android:drawablePadding="5dp"
android:text="cc" />
</RelativeLayout>
</RelativeLayout>
there should be two buttons in the screen with same width in the center. but there is nothing but blank screen x.x I'm not that new in developing android, but sometimes I miss little details which give me a lot of headache. sorry for disturbing
Replace the RelativeLayout that wraps your Buttons with a LinearLayout like this:
<LinearLayout
android:orientation="horizontal"
android:layout_width="100dp"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" >
<Button
android:id="@+id/bb"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:drawableLeft="@drawable/bb"
android:drawablePadding="5dp"
android:text="bb" />
<Button
android:id="@+id/cc"
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_below="@id/bb"
android:drawableLeft="@drawable/cc"
android:drawablePadding="5dp"
android:text="cc" />
</LinearLayout>
RelativeLayout does not support weight.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With