2012-06-20 4 views
0

enter image description hereРасширение TextView скрывает изображение

Как было показано выше, Это мой обычай ListView с некоторыми флажками на некоторых из них. В основном есть два текстовых изображения и одно изображение. Моя проблема - всякий раз, когда текст в верхнем текстовом представлении большой, изображение выходит из экрана, и галочка не отображается.

Я хочу, чтобы ширина верхнего текста должна расширяться в соответствии с длиной текста, но не должна скрывать галочку.

Любая помощь Оценить.

EDIT:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:padding="6dip" 
android:background="@color/black"> 
<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentTop="true" 
    android:layout_alignParentBottom="true" 
    android:layout_marginRight="6dip" 
    android:id="@+id/row_image"/> 
    <ImageView 
     android:id="@+id/multiselect_icon" 
     android:src="@drawable/singlecheck" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentTop="true" 
     android:layout_alignParentBottom="true" 
     android:layout_toRightOf="@id/row_image" 
     android:visibility="gone"/> 
     <TextView 
      android:id="@+id/top_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_toRightOf="@id/multiselect_icon" 
      android:layout_alignParentTop="false" 
      android:layout_alignParentRight="false" 
      android:textStyle="bold" 
          android:layout_weight="1" 
      android:textColor="@color/white"/> 
        <ImageView 
          android:id="@+id/shared_icon" 
          android:src="@drawable/sharedcheck" 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:layout_toRightOf="@id/top_view" 
          android:visibility="gone"/> 
        <TextView 
      android:id="@+id/bottom_view_1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="false" 
      android:layout_alignParentLeft="false" 
      android:layout_below="@id/top_view" 
      android:layout_toRightOf="@id/multiselect_icon" 
          android:gravity="left" 
          android:textColor="@color/lightGray" 
          android:visibility="gone"/> 
     <TextView 
      android:id="@+id/bottom_view" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:layout_alignParentRight="true" 
      android:layout_below="@id/top_view" 
      android:gravity="right" 
          android:textColor="@color/lightGray"/> 
</RelativeLayout> 

ответ

1

Мысль, разделяющая ответ, чтобы он мог кому-то помочь.

Я добавил верхнее текстовое поле & галочкой в ​​линейный лоток &, он решил проблему.

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/upper_view" 
    android:layout_toRightOf="@id/multiselect_icon" 
    android:layout_alignParentTop="false" 
    android:layout_alignParentRight="false"> 

    <TextView 
     android:id="@+id/top_view" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textStyle="bold" 
    android:layout_weight="1" 
     android:textColor="@color/white"/> 
    <ImageView 
    android:id="@+id/shared_icon" 
    android:src="@drawable/sharedcheck" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_toRightOf="@id/top_view" 
    android:visibility="gone"/> 

</LinearLayout>   
+0

Но это держит изображение sharedcheck вправо, не так ли? – monchote

+0

@monchote да. но по крайней мере это видно сейчас всегда. Я пытался играть с весами, чтобы сделать это, как указано выше, но не прошел. Если вы можете предоставить что-нибудь с этим, я был бы признателен. –

0

Использование

android:layout_weight="1" 

textview на языке XML.

+0

не работает .... –

+0

он не будет работать на относительном макете –

+0

то, что я должен делать ??? –

0

Если вы используете LinearLayout для своих элементов ListView, я бы порекомендовал вас заменить его на RelativeLayout, а затем сделайте TextView выровненным слева от галочки.

+0

Я использую относительный макет только с выравниванием левой вещи. Это не работает. –

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