dimanche 3 juillet 2016

Android, layout_height="match_parent" doesn't want to work in View

So, I have created shape line.xml

<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:fromDegrees="90"
    android:toDegrees="90">
    <shape
        android:shape="line">
        <stroke
            android:width="1dp"
            android:color="#ff00ff"
            android:dashWidth="1dp"
            android:dashGap="2dp" />
    </shape>
</rotate>

And I'm using it in recycler like this:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

  <LinearLayout
        android:orientation="vertical"
        android:layout_width="50dp"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout2">

        <View
            android:id="@+id/circle"
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:background="@drawable/circle"/>

        <View
            android:id="@+id/line"
            android:layout_width="match_parent"
            android:minHeight="50dp"
            android:layout_height="match_parent"
            android:background="@drawable/line"/>

    </LinearLayout>
</RelativeLayout>

When a recycler item has for example 100dp of height, the line still has 50dp. Line should has height the same as recycelr item. How can i achive this?

Aucun commentaire:

Enregistrer un commentaire