menu_on_top
menu_on_top

Reputation: 2613

Custom dialog with 2 buttons

I want to create a custom dialog.i have created an res/values/action.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>

     <style name="Theme.RCAlertDialog" parent="android:style/Theme.Dialog">

        <item name="android:windowBackground">@drawable/quick_action2</item>

    </style>
</resources>

the drawable i m using is this:

enter image description here

i want to have two buttons inside my graphic that the sum of their two width will be as the width of the red box.How can i do it? this is the code i m using now but the result is changing from portrait to landscape mode.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginLeft="30px"
        android:layout_marginTop="21px"
        android:layout_weight="1"
        android:background="@drawable/fav2" />

    <ImageButton
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_marginRight="30px"
        android:layout_marginTop="21px"
        android:layout_weight="1"
        android:background="@drawable/eat2" />

</LinearLayout>

Is there any good way to do it right?thanks

Upvotes: 0

Views: 326

Answers (1)

rDroid
rDroid

Reputation: 4945

Check the size of the dawables : @drawable/fav2 and @drawable/eat2. Dont give as background for ImageButton, instead set it as source(src).

Upvotes: 2

Related Questions