android:CheckedTextView不能被检查? [英] android: CheckedTextView cannot be checked?

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

问题描述

最初,我想要一个复选标记,其中文本放置在复选标记的左侧。在这个网站上搜索后,我发现最好的解决方法是android:CheckedTextView?但是,我发现用户不能手动更改复选标记。是设计吗?

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"/> 


推荐答案

您可能只想使用一个< =http://developer.android.com/reference/android/widget/CheckBox.html =nofollow noreferrer> 复选框 (继承 Button ,因此 TextView )。 CheckedTextView 旨在使用列表视图。示例复选框布局XML如下:

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" />

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

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