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

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

热点内容
pythoniris 发布:2025-03-15 09:05:27 浏览:188
浪淘沙服务器怎么没有了 发布:2025-03-15 09:05:26 浏览:97
ftprpm安装包下载 发布:2025-03-15 09:03:53 浏览:721
如何判断背包配置 发布:2025-03-15 09:03:00 浏览:899
淘宝api源码 发布:2025-03-15 09:00:00 浏览:159
压缩复原修车 发布:2025-03-15 08:46:52 浏览:78
linux调试汇编 发布:2025-03-15 08:38:09 浏览:107
手机上编写c语言 发布:2025-03-15 08:17:53 浏览:754
上传迅雷下载速度 发布:2025-03-15 08:07:50 浏览:554
好看解压书 发布:2025-03-15 08:04:18 浏览:672