1

내 응용 프로그램의 디자인 작업 중이지만 ListView의 항목 디자인에 문제가 있습니다.ListView Item layout

Attacched을 사용하면 어떻게 보이는지, 어떻게 나타나고 있는지 확인할 수 있습니다.

<TwoLineListItem xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="?android:attr/activatedBackgroundIndicator" 
android:minHeight="?android:attr/listPreferredItemHeight" > 

     <TextView android:id="@android:id/text1" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="?android:attr/listPreferredItemPaddingLeft" 
      android:layout_marginTop="8dip" 
      android:textAppearance="?android:attr/textAppearanceListItem" 
     /> 


     <RelativeLayout android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_alignParentRight="true" > 

      <ImageView 
      android:id="@+id/favourite_status" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_alignParentRight="true" 
      android:layout_alignTop="@android:id/text1" 
      android:src="@drawable/is_not_favourite" 
      android:contentDescription="@string/list_favorites_status" 
      android:background="@null" 
      android:layout_margin="9dp"/> 

     </RelativeLayout> 

     <TextView android:id="@android:id/text2" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@android:id/text1" 
      android:layout_alignLeft="@android:id/text1" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
     /> 



    </TwoLineListItem> 

문제는 텍스트입니다 :

은 항목의 레이아웃입니다 내가 설명은 비어 있어야 공간에 오버 플로우 싶지 않다. 도움을 미리 요청 해 주셔서 감사합니다.

How it looks like

How it should be

+0

와 같은 달성 할 수있다 값을주는 대신 wrapContent를 사용하십시오. – thepoosh

+1

레이아웃을 올바르게 구성해야합니다. 위의 레이아웃은 텍스트보기 (제목), relativelayout (이미지), 기본적으로 오른쪽으로 떠서 다음 남은 공간을 모두 먹는 최종 텍스트 뷰 (설명)가 있습니다. – ASceresini

+0

도움 주셔서 감사합니다. 문제는 내가 별 아래 공간을 공백으로 남겨두고 텍스트가 넘치지 않게하려는 것입니다. – Gnufabio

답변

0

쉬운, 당신은 다음을 수행 할 수 있습니다

<LinearLayout 
    .... 
    android:orientation="horizontal" 
    ....> 
    <LinearLayout 
     .... 
     android:orientation="vertical" 
     ....> 
     <TextView /> 
     <TextView /> 
    </LinearLayout> 
    <ImageView /> 
</LinearLayout> 

이것은 기본 레이아웃, 당신은 또한 RelativeLayout의 당신은`사용

+0

http://pastebin.com/UXgxfG9k 여전히 동일한 결과입니다. – Gnufabio