机器人:CheckedTextView不能被选中? [英] android: CheckedTextView cannot be checked?

查看:388
本文介绍了机器人:CheckedTextView不能被选中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

起初我想勾选其中的文字放在复选标记的左侧。搜索在这个网站后,我发现最好的解决方法是安卓CheckedTextView?然而,我发现,复选标记,不能由用户手动更改。它是由设计?

 < CheckedTextView的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
 机器人:ID =@ + ID / autoupdatecheckboxview
 机器人:layout_width =FILL_PARENT
 机器人:layout_height =WRAP_CONTENT
 机器人:重力=center_vertical
 机器人:对号=机器人:ATTR / listChoiceIndicatorMultiple
 机器人:以下属性来=6dip
 机器人:paddingRight =6dip
 机器人:文本=弹出一个消息时,新的数据可用
 机器人:字体=SANS的Andr​​oid版本:TEXTSIZE =16dip/>
 

解决方案

您可能希望只使用一个普通的 复选框 (继承自按钮,从而的TextView )。 CheckedTextView 的设计与列表视图的工作。示例复选框布局XML是如下:

 <复选框
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:layout_height =WRAP_CONTENT
    机器人:文本=弹出一个消息时,新的数据可用
    机器人:TEXTSIZE =16dip/>
 

Initially I wanted a checkmark where the text is placed on the left of the checkmark. After searching on this site I found out the best workaround is android:CheckedTextView? However, I found out that the checkmark cannot be changed manually by users. Is it by design?

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android" 
 android:id="@+id/autoupdatecheckboxview" 
 android:layout_width="fill_parent" 
 android:layout_height="wrap_content" 
 android:gravity="center_vertical" 
 android:checkMark="?android:attr/listChoiceIndicatorMultiple" 
 android:paddingLeft="6dip" 
 android:paddingRight="6dip" 
 android:text="Pop up a message when new data available" 
 android:typeface="sans" android:textSize="16dip"/> 

解决方案

You probably want to just use a regular CheckBox (which inherits from Button and thus TextView). CheckedTextView is designed to work with list views. Example CheckBox layout XML is below:

<CheckBox
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:text="Pop up a message when new data available"
    android:textSize="16dip" />

这篇关于机器人:CheckedTextView不能被选中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆