由网友(陽光有點冷)分享简介:起初我想勾选其中的文字放在复选标记的左侧。搜索在这个网站后,我发现最好的解决方法是安卓CheckedTextView?然而,我发现,复选标记,不能由用户手动更改。它是由设计?< CheckedTextView的xmlns:机器人=http://schemas.android.com/apk/res/andro...
起初我想勾选其中的文字放在复选标记的左侧。搜索在这个网站后,我发现最好的解决方法是安卓CheckedTextView?然而,我发现,复选标记,不能由用户手动更改。它是由设计?
< CheckedTextView的xmlns:机器人=http://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的Android版本:TEXTSIZE =16dip/>
解决方案
您可能希望只使用一个普通的 复选框
(继承自按钮
,从而的TextView
)。 CheckedTextView
的设计与列表视图的工作。示例复选框
布局XML是如下:
<复选框
的xmlns:机器人=http://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" />
相关推荐
最新文章