这是一个list中item的布局,问题是搞不清layout_marginLeft这个属性
<?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="wrap_content">

<TextView android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"
android:id="@+id/tv_itemName"/>
</RelativeLayout>
这个布局的效果正常,不正常的是把layout_marginLeft换为layout_marginRight的话,item尽然是居左对齐了(也就是没效果了),愿意是想这个item居右10dip对齐
请高人指点一下

解决方案 »

  1.   

    layout_marginRight 只是说名右边空白的多少,不能少于的意思,
    如果要对其的话用alien相关属性
      

  2.   

    android:layout_marginLeft是控件左边空出相应的距离。也就是说你这么设置了,就是让textview在每项里从x=10dip的位置显示。你可以试试layout_marginLeft和layout_marginRight都设置为10,这样应该可以。或者layout_marginLeft为0,layout_marginRight为10
      

  3.   

    我觉得你把RelativeLayout换成LinearLayout就应该没问题了,我以前也遇到过你这样的问题,建议最好不要用数值来安排控件的位置,可以用控件的Gravity属性和Layout Gravity属性来安排控件位置。而且一般倾向于使用LinearLayout进行界面的设置,除非到了非用Relativelayout不可的地步才使用它。
      

  4.   

    layout_marginLeft为0
    layout_marginRight为10
    应该这样搞