分隔符不以相对布局显示

时间:2015-01-25 14:18:59

标签: android xml layout relativelayout

我有一个如下所示的视图。在imageview之前有一个分隔符(垂直分隔符)。我可以在图形布局上看到分隔符,但是当我运行代码时,分隔符不会显示在模拟器和手机上。

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/product_list_item"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:orientation="vertical"
    android:padding="0sp" >

    <RelativeLayout
        android:id="@+id/RelativeLayout1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:padding="5sp" >

        <TextView
            android:id="@+id/product_name"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"

            android:layout_alignParentStart="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentTop="true"
            android:layout_toStartOf="@+id/product_price"
            android:layout_toLeftOf="@+id/product_price"

            android:text="product_name"
            android:layout_centerVertical="true"
            android:textColor="#2c3e50"
            android:textSize="15sp"/>

        <TextView
            android:id="@+id/product_price"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:layout_alignParentTop="true"
            android:layout_toStartOf="@+id/seperator"
            android:layout_toLeftOf="@+id/seperator"

            android:text="525 manat"
            android:layout_centerVertical="true"
            android:textColor="#34495e"
            android:textSize="15sp"

            android:layout_marginEnd="10sp"
            android:layout_marginLeft="10sp"
            android:layout_marginRight="5sp"
            android:layout_marginStart="5sp"/>

        <View
            android:id="@+id/seperator"
            android:layout_width="2sp"
            android:layout_height="match_parent"

            android:layout_toStartOf="@+id/addCartBtn"
            android:layout_toLeftOf="@+id/addCartBtn"
            android:layout_alignParentTop="true"

            android:layout_marginEnd="2sp"
            android:layout_marginStart="2sp"
            android:layout_marginLeft="2sp"
            android:layout_marginRight="2sp"
            android:background="#9a9d9f" />

        <ImageView
            android:id="@+id/addCartBtn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"

            android:layout_alignParentTop="true"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"

            android:layout_centerVertical="true"
            android:layout_marginLeft="3sp"
            android:layout_marginRight="3sp"
            android:background="#FFFFFF"

            android:focusable="false"
            android:focusableInTouchMode="false"

            android:src="@drawable/addcart" />
    </RelativeLayout>

    <View
        android:layout_width="match_parent"
        android:layout_height="1dp"
        android:background="#767e84" />

</LinearLayout>

0 个答案:

没有答案