繁体   English   中英

如何在Android中将RadioButton上的图像大小减小到所需大小?

[英]How to decrease the size of an Image on a RadioButton to a desired size in Android?

我试图形成3个带有图像的单选按钮。 因此,我使用了XML属性android:button 但是由于我的图片尺寸太大,我看不到它适合按钮。

以下是我的XML代码:

<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>

我要来的是 这个 我想去这里的是 这个

感谢您的时间!

我认为您必须使用“ Paint.net”其他图像编辑工具来缩小图像

您应该将可绘制对象放置在用于单选按钮的xml文件中,然后只需将android:button设置为xml文件,而不是可绘制对象即可。 如果这样做,您可以简单地使用width / height属性更改大小。 有关更多信息,请阅读此线程。 如何设置单选按钮的宽度以更改屏幕大小? (android)及其最佳答案。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM