如何使用文本右侧的选项创建RadioButton
?Android文本右侧的RadioButton选项
5
A
回答
4
这没关系,我用CheckTextView代替
1
像@Arutha mentioned in the above answer,你可以使用一个CheckedTextView
。这可以通过使用内置的Android的布局(如我贴here)来完成 - android.R.layout.simple_list_item_single_choice
:
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<CheckedTextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeightSmall"
android:textAppearance="?android:attr/textAppearanceListItemSmall"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" />
如果要修改它,你可以在上面的复制粘贴到一个新的XML文件,然后使用<include>
标签将其包含在其他布局中(在Apache 2.0 License下)。您也可以将它用作列表项目,并保持不变。
相关问题
- 1. LinearLayout的左侧是TextView,右侧是RadioButton?
- 2. Android中CheckBox右侧的文本
- 3. Android TextView右侧
- 4. UIToolBar左侧/右侧按钮文本
- 5. IE截断文本右侧
- 6. Android列表项:左侧的TextView,右侧的图片
- 7. TabControl c的右侧和左侧的选项卡#
- 8. Android NavigationView从右侧
- 9. 手风琴中的选项卡左侧和内容右侧
- 10. 在Android中更改Gridview右侧副本
- 11. 在右侧的EditView中显示文本
- 12. 在div的右侧放置文本
- 13. 在右侧切掉的文本字段
- 14. 如何在Android的MenuItem中显示文本右侧的图标?
- 15. 如何设置文本的右侧的复选框
- 16. 与Android中的文本RadioButton的边框
- 17. android-remove在右侧选项菜单中删除子菜单项的标题?
- 18. Android的布局图像和两个文本框右侧
- 19. 如何将单选按钮对齐相关文本的右侧?
- 20. Android - LinearLayout右侧和右侧的空白空间
- 21. Android:以编程方式在右侧设置复选框设置文本位置
- 22. 在shinydashboard标题右侧添加文本
- 23. Android - 右侧屏幕按钮
- 24. MeasureString()填充左侧和右侧的文本
- 25. 对齐图像顶部,右侧,底部和左侧的文本?
- 26. HTML:在屏幕的左侧和右侧有文本区域
- 27. 如何使用此代码将TextView放到左侧,并将Radiobutton放到右侧?
- 28. Android:自定义按钮与图像,而文本对齐到左侧和右侧
- 29. 如何将动画android文本视图缩放到右侧
- 30. 布局文件 - 将项目定位到另一个项目的右侧(Android)