-1

У меня есть ListView:есть переключатель на элементе списка

<ListView 
     android:id="@+id/my_list" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" /> 

Компоновка каждый элемент строки в виде списка является:

<? Xml version = "1.0" encoding = "utf-8"?> 
<LinearLayout 
    xmlns: android = "http://schemas.android.com/apk/res/android" 
    android: orientation = "horizontal" 
    android: layout_width = "fill_parent" 
    android: layout_height = "fill_parent" 
    > 
    <ImageView 
      android: id = "@+id/my_img" 
      android: layout_width = "wrap_content" 
      android: layout_height = "wrap_content" 
      android: layout_gravity = "center_vertical"   
      /> 
    <TextView 
     android: id = "@+id/my_value" 
     android: layout_width = "wrap_content" 
     android: layout_height = "wrap_content" 
     android: textColor = "@drawable/ black" /> 
</ LinearLayout> 

Как вы видите выше, каждый строку списка состоит из ImageView и TextView. Теперь, я хотел бы иметь радиокнопку рядом с TextView, как добавить переключатель в моем случае?

+1

Используйте '' Relativelayout' и добавить конец Textview' –

+0

Где вопрос? – Dharmendra

ответ

1

попробовать этот

<? Xml version = "1.0" encoding = "utf-8"?> 
<RelativeLayout 
    xmlns: android = "http://schemas.android.com/apk/res/android" 
    android: layout_width = "fill_parent" 
    android: layout_height = "fill_parent" 
    > 
    <ImageView 
      android: id = "@+id/my_img" 
      android: layout_width = "wrap_content" 
      android: layout_height = "wrap_content" 
      android:layout_algnParentLeft="true" 
      android: layout_centerVertical = "true"   
      /> 
    <TextView 
     android: id = "@+id/my_value" 
     android: layout_width = "wrap_content" 
     android: layout_height = "wrap_content" 
     android:layout_toRightOf="@id/my_img" 
     android: textColor = "@drawable/ black" /> 
    <RadioButton 
     android: id = "@+id/radio" 
     android: layout_width = "wrap_content" 
     android: layout_height = "wrap_content" 
     android:layout_toRightOf="@id/my_value" /> 

</ RelativeLayout> 
+1

Vipin вы можете объяснить нам, в чем вопрос? – RobinHood

+0

@robinhood Leem.fin отредактировал свой вопрос после моего ответа, не знаю почему – vipin

+1

он дал xml, и он спрашивал, как добавить радио перед текстовым видом – vipin

Смежные вопросы