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

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

热点内容
rmijava 发布:2025-09-18 08:38:26 浏览:18
sql软件和服务器怎么连接 发布:2025-09-18 08:27:47 浏览:937
手机java模拟器 发布:2025-09-18 07:13:29 浏览:418
linux线程的栈大小 发布:2025-09-18 07:09:42 浏览:633
废旧电脑做linux服务器 发布:2025-09-18 07:06:50 浏览:263
终端配置怎么写 发布:2025-09-18 06:44:42 浏览:804
ftp手机登陆 发布:2025-09-18 06:43:04 浏览:767
emc存储800电话 发布:2025-09-18 06:32:49 浏览:964
c语言编程与设计 发布:2025-09-18 06:09:15 浏览:724
2016年预算法 发布:2025-09-18 06:07:05 浏览:625