当前位置:首页 » 安卓系统 » android单选钮

android单选钮

发布时间: 2023-08-16 19:51:36

Ⅰ 如何实现android中三个单选按钮横向排列且只能选一个

<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/row_item_margin">

<TextView
android:id="@+id/tvStorageWay"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:text="储存方式:"/>

<RadioGroup
android:id="@+id/rgStorageWay"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/tvStorageWay"
android:gravity="center_vertical"
android:orientation="horizontal">

<RadioButton
android:id="@+id/rbPack"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:button="@null"
android:drawableLeft="@drawable/selector_login_mode_radiobutton"
android:text="包装"/>

<RadioButton
android:id="@+id/rbBulk"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/row_item_margin"
android:layout_weight="1"
android:button="@null"
android:drawableLeft="@drawable/selector_login_mode_radiobutton"
android:text="散装"/>

<RadioButton
android:id="@+id/rbStorageWayOther"
style="@style/EditTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/row_item_margin"
android:layout_weight="1"
android:button="@null"
android:drawableLeft="@drawable/selector_login_mode_radiobutton"
android:text="其它"/>
</RadioGroup>
</RelativeLayout>

Ⅱ 问一下 android radiobutton控件 控制单选按钮和文字之间的距离的问题

我觉得RadioButton原始的button如果设置为 android:button="@null“ 而用android:drowableLeft=”@drawable/radiobtn_selector“;这样显示图片的话效果会更加好,而且可以用android:drawablePading=”10dp“这个属性控制图片和字儿的距离。

希望可以帮到你。Thanks

Ⅲ android单选按钮

你要当成单选的一组的radiobutton要放在radioGROUP下,不然这个GROUP就没起作用
只有这样写,才能实现这组radiobutton是单选的效果。

Ⅳ android 用imageview实现单选功能

imageView2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
v.setBackgroundResource(null); v.setBackgroundResource(R.drawable.adddoorbellon);
ImageView imageView = (ImageView) findViewById(R.id.yimenling_oneclick);
imageView.setBackgroundResource(R.drawable.akeyconfiguration);
}
});

这样试试,,最好把你的错误日志发出来

热点内容
小米没有存储空间 发布:2025-07-09 15:13:36 浏览:597
编译安装内核时磁盘容量缩小 发布:2025-07-09 15:08:45 浏览:41
lol代练全是用脚本吗 发布:2025-07-09 15:06:56 浏览:713
车载导航服务器地址 发布:2025-07-09 15:01:40 浏览:672
金融机购贷的车款怎么解压 发布:2025-07-09 15:01:40 浏览:325
pc脚本精灵 发布:2025-07-09 14:59:53 浏览:9
吃东西解压电视剧 发布:2025-07-09 14:59:03 浏览:54
c语言字符串转10进制 发布:2025-07-09 14:56:51 浏览:236
服务器记录ip地址数量 发布:2025-07-09 14:56:49 浏览:284
c语言abc大小 发布:2025-07-09 14:51:37 浏览:544