当前位置:首页 » 安卓系统 » 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);
}
});

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

热点内容
java返回this 发布:2025-10-20 08:28:16 浏览:556
制作脚本网站 发布:2025-10-20 08:17:34 浏览:840
python中的init方法 发布:2025-10-20 08:17:33 浏览:546
图案密码什么意思 发布:2025-10-20 08:16:56 浏览:721
怎么清理微信视频缓存 发布:2025-10-20 08:12:37 浏览:645
c语言编译器怎么看执行过程 发布:2025-10-20 08:00:32 浏览:963
邮箱如何填写发信服务器 发布:2025-10-20 07:45:27 浏览:217
shell脚本入门案例 发布:2025-10-20 07:44:45 浏览:74
怎么上传照片浏览上传 发布:2025-10-20 07:44:03 浏览:765
python股票数据获取 发布:2025-10-20 07:39:44 浏览:673