在列表视图中单选按钮视图、单选、按钮、列表

由网友(微雨清涼夏已盡)分享简介:我显示在列表视图中甲刺的名单,我用默认的列表视图中,并放置一个单选按钮,使用 simple_list_item_single_choice 。但是,这显示在右侧的单选按钮,我想显示在左侧的单选按钮。是,任何可能的使用显示左侧的单选按钮默认列表视图I am showing list of sting in list v...

我显示在列表视图中甲刺的名单,我用默认的列表视图中,并放置一个单选按钮,使用 simple_list_item_single_choice 。但是,这显示在右侧的单选按钮,我想显示在左侧的单选按钮。是,任何可能的使用显示左侧的单选按钮默认列表视图

I am showing list of sting in list view formate, i used default list view and placed a radio button by using simple_list_item_single_choice. But this shown the Radio button in right side, i want to display the radio button in left side. is that any possible to show the radio button in left side using default list view

推荐答案

simple_list_item_single_choice.xml 使用 CheckedTextView

下面是 simple_list_item_single_choice.xml

 <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/listPreferredItemHeight"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:gravity="center_vertical"
    android:checkMark="?android:attr/listChoiceIndicatorSingle"
    android:paddingLeft="6dip"
    android:paddingRight="6dip"
   />

您需要创建一个自定义XML您的需求,并使用复选框来实现自己的目标 这是你的 custom.xml

You need to create a custom xml for your need and use a CheckBox to achieve your goal Here is your custom.xml

 <CheckBox
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/text1"
    android:layout_width="fill_parent"
    android:layout_height="?android:attr/listPreferredItemHeight"
    android:textAppearance="?android:attr/textAppearanceLarge"
    android:gravity="center_vertical"
    android:button="?android:attr/listChoiceIndicatorSingle"
    android:paddingLeft="6dip"
    android:paddingRight="6dip"
   />

只需使用 custom.xml 代替 simple_list_item_single_choice.xml 在你的code。

Just use the custom.xml in place of simple_list_item_single_choice.xml in your code.

希望它可以帮助你。

阅读全文

相关推荐

最新文章