<layer-list
xmlns:android="http://schemas.android.com/apk/res/android"
>
<!--width here doesn't work-->
<item
android:gravity="left"
android:width="10dp"
>
<shape
android:shape="rectangle"
>
<stroke
android:width="1dp"
android:color="@color/black"
/>
<!--<gradient-->
<!--android:startColor="#00dddddd"-->
<!--android:endColor="#40404040"-->
<!--android:angle="0"-->
<!--/>-->
</shape>
</item>
<!--width here doesn't work-->
<item
android:width="10dp"
android:gravity="right"
>
<shape
android:shape="rectangle"
>
<stroke
android:width="1dp"
android:color="@color/black"
/>
<!--<gradient-->
<!--android:startColor="#00dddddd"-->
<!--android:endColor="#40404040"-->
<!--android:angle="180"-->
<!--/>-->
</shape>
</item>
ist hier das Beispiel.
Es funktioniert in Lollipop oder höher, aber es funktioniert nicht in Kitkat, die Breite wird ignoriert, das Rechteck füllt die gesamte Ansicht.
Ich habe auch versucht, das zweite Element zu entfernen, hinterlässt nur das erste Element, die Breite wird immer noch ignoriert.
Der Image verwendet dieses ziehbar:
<!--Width will be changed dynamically-->
<ImageView
android:id="@+id/someid"
android:layout_width="100dp"
android:layout_height="@dimen/someheight"
android:src="@drawable/the_xml_above"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:clickable="false"
/>
Wie dieses Problem zu lösen?