在这张图片中,金色的分隔线不适合屏幕。我想让这条线适合屏幕。我用的是fill_parent..but,这给了我这样的布局……
这是我的自定义xml文件
<?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"
android:orientation="vertical"
android:id="@+id/main"
>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="40dp"
android:layout_centerVertical="true" android:background="#000000">
<ImageView
android:id="@+id/imageView1"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="1dp"
android:src="@drawable/arrow" />
<LinearLayout
android:id="@+id/linear1"
android:layout_width="fill_parent"
android:layout_height="2dp"
android:layout_alignParentBottom="true"
android:background="@drawable/seprater_line" />
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="TextView"
android:textColor="@android:color/white"
android:textSize="18sp" />
</RelativeLayout>
</RelativeLayout>
发布于 2012-07-24 10:11:54
ListView
的分隔符和ListView
本身一样宽。看看你的截图,你已经为你的ListView
设置了一些边距或填充,这也会导致为分隔符设置边距/填充。去掉这些属性,你的分隔线将覆盖整个屏幕的宽度。通过为行本身定义自定义xml文件,如果需要,您可以在其中添加自定义填充/边距。
https://stackoverflow.com/questions/11628530
复制