Android:以编程方式设置页边距错误:重叠

时间:2015-08-10 06:28:06

标签: android

如果没有特定问题的图像,我正在努力增加保证金。

我能够从底部增加边距,但列表视图和选项是重叠的。

代码

img.setVisibility(View.GONE);
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams)tvOptiontitle.getLayoutParams();
params.setMargins(0, 0, 0, 170); 
tvOptiontitle.setLayoutParams(params);

RelativeLayout.LayoutParams params1 = (RelativeLayout.LayoutParams)listviewoptions.getLayoutParams();
params1.setMargins(0, 0, 0, 130); 
tvOptiontitle.setLayoutParams(params1);

XML

<ListView
    android:id="@+id/lstviewoptionAptitude"
    android:layout_width="match_parent"
    android:layout_height="250dp"
    android:layout_above="@+id/btnPrevQues"
    android:layout_alignLeft="@+id/btnPrevQues"
    android:layout_alignRight="@+id/btnNextQues"
    android:layout_marginBottom="30dp" >

</ListView>

<TextView
    android:id="@+id/txtOptionTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_above="@+id/lstviewoptionAptitude"
   android:paddingBottom="20dp"
    android:layout_alignLeft="@+id/lstviewoptionAptitude"
    android:text="Option Title"
    android:textAppearance="?android:attr/textAppearanceMedium" />

输出:

enter image description here

0 个答案:

没有答案