0

I am trying to form 3 radio buttons with Image on them. So I have used the XML attribute android:button. But since my image size is too big, I can't see it fit in the button.

Following is my XML code:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/netbankingRoot"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:padding="10dp"
    android:layout_marginTop="50dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    tools:context=".activities.fragments.NetBankingFragment">


    <TableLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/listOfBanks"
        android:padding="20dp"
        android:layout_marginLeft="60dp">

        <TableRow
            android:layout_marginBottom="5dp">
            <RadioButton
                android:layout_height="60dp"
                android:layout_width="60dp"
                android:id="@+id/sbi"
                android:text="SBI"
                android:padding="30dp"
                android:button="@drawable/sbilogo"
                android:layout_marginRight="20dp"/>


            <RadioButton
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:id="@+id/axis"
                android:text="AXIS"
                android:padding="10dp"/>

        </TableRow>

        <TableRow
            android:layout_marginBottom="5dp">

            <RadioButton
                android:layout_height="wrap_content"
                android:layout_width="wrap_content"
                android:id="@+id/citi"
                android:text="CITI"
                android:padding="10dp"/>

        </TableRow>




    </TableLayout>
</ScrollView>

What I'm getting here is this. What I'm trying to get here is this

Thank you for your time!

Auro
  • 1,578
  • 3
  • 31
  • 62

2 Answers2

0

I think you have to make the image small by using some other Image editing tool as "Paint.net"

jaunvi
  • 111
  • 8
0

You should place your drawables in an xml file for radio buttons and then simply set android:button to the xml file, instead of drawable. If you do so you can simply change the size using width/height attributes. For more information read this thread How can I set the width of radio buttons to change with regards to screen size? (android) and its top answer.

Community
  • 1
  • 1
sp0rk
  • 483
  • 4
  • 14