2011-12-07 13 views
1

私が達成しようとしているレイアウトに関する少しの助けを探しています。私はそれの中の各項目のためのRelativeLayoutとListViewを使用しています。私はアバター、タイトルとテキスト情報を正しく表示できますが、タイトルと同じ行にtime_stampを置くことはできません。したがって、アバターは左にあり、一番上のタイトルは、同じ行に沿って右端のタイムスタンプ、text_infoはすぐ下にあります。 = "true" をlayout_alignParentRightを使用し、リストビューのAndroid相対レイアウト

TIME_STAMPのTextViewのために
<?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="?android:attr/listPreferredItemHeight" 
     > 

    <ImageView 
      android:id="@+id/avatar" 
      android:layout_width="wrap_content" 
      android:layout_height="fill_parent" 
      android:scaleType="center" 
      android:layout_marginRight="3dip" 
      android:src="@drawable/icon" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentLeft="true" 
      /> 


    <TextView 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:id="@+id/text_title" 
      android:layout_toRightOf="@id/avatar" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentTop="true" 
      android:layout_alignWithParentIfMissing="true" 
      android:gravity="center_vertical" 
      android:textSize="18sp" 
      android:textStyle="bold" 
      android:textColor="#FFFFFF" 
      /> 

    <TextView  
      android:id="@+id/time_stamp" 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:layout_toRightOf="@id/text_title" 
      /> 

    <TextView 
      android:id="@+id/text_info" 
      android:layout_height="wrap_content" 
      android:layout_width="fill_parent" 
      android:layout_weight="1" 
      android:layout_toRightOf="@id/avatar" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentBottom="true" 
      android:singleLine="true" 
      /> 
</RelativeLayout> 

答えて

0

とlayout_alignTopは、タイトルのTextViewに設定し、次のように

レイアウトです。それはリストの右側に表示され、トップはタイトルに合わせられます。幸運

+0

パーフェクト!ありがとうございました!! – DanyZift

関連する問題