2013-11-25 7 views
0

ListView에서 ImageView의 아이콘을 올바르게 정렬하려면 어떻게해야합니까? 나는 중력 = "right"를 시도했지만 작동하지 않았습니다. 특별히 linerlayout을 추가해야합니까? 당신의 도움을 주셔서 감사합니다.내 ListItem의 아이콘을 오른쪽 정렬하는 방법

enter image description here

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:minHeight="?android:attr/listPreferredItemHeight" 
    android:gravity="center_vertical" 
    android:paddingRight="?android:attr/scrollbarSize"> 

    <ImageView 
     android:id="@+id/list_item_entry_drawable" 
     android:layout_width="50dip" 
     android:layout_height="50dip" 
     android:gravity="right" 
     android:src="@android:drawable/ic_menu_preferences" 
     android:paddingLeft="9dp"/> 

    <RelativeLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="10dip" 
     android:layout_marginRight="6dip" 
     android:layout_marginTop="6dip" 
     android:layout_marginBottom="6dip" 
     android:layout_weight="1"> 

     <TextView android:id="@+id/list_item_entry_title" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:singleLine="true" 
      android:textAppearance="?android:attr/textAppearanceLarge" 
      android:ellipsize="marquee" 
      android:fadingEdge="horizontal" /> 

     <TextView android:id="@+id/list_item_entry_summary" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/list_item_entry_title" 
      android:layout_alignLeft="@id/list_item_entry_title" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:singleLine="true" 
      android:textColor="?android:attr/textColorSecondary" /> 

    </RelativeLayout> 

</LinearLayout> 

답변

0

당신은 RelativeLayout의에 이미지 뷰를 넣고 아래의 코드를 사용한다 :이 도움이됩니다

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentRight="true" 
    android:layout_centerVertical="true" 
    android:src="@drawable/your_icon" /> 

희망을 아래에 내 코드입니다.