0
我正在設計應用程序的UI,並希望將我的佈局分爲4個部分。 (使用兩條正交線)。旋轉筆畫不填充高度
佈局的背景必須是sweep
型gradiant顏色象下面這樣:
<shape android:shape="rectangle" >
<gradient
android:centerColor="@color/gradiant_center_color"
android:endColor="@color/gradiant_end_color"
android:startColor="@color/gradiant_start_color"
android:type="sweep" />
</shape>
要創建垂直線,我使用從rotate
和stroke
如下:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<rotate
android:fromDegrees="90"
android:pivotX="50%"
android:pivotY="50%" >
<shape android:shape="line" >
<stroke
android:width="1dip"
android:color="@color/separator_color" />
</shape>
</rotate>
</item>
<item>
<shape
android:shape="line" >
<stroke
android:width="1dp"
android:color="@color/separator_color" />
</shape>
</item>
</layer-list>
現在,我將兩個可繪製並創建如下背景:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle" >
<gradient
android:centerColor="@color/gradiant_center_color"
android:endColor="@color/gradiant_end_color"
android:startColor="@color/gradiant_start_color"
android:type="sweep" />
</shape>
</item>
<item android:drawable="@drawable/separator_border"/>
</layer-list>
好吧,設置佈局背景後,我的背景是:
正如你在圖像上看到,水平線不填充屏幕。所以爲什麼 ?! 請給我一個解決方案來解決我的問題。
感謝提前:)
您的解決方案對我無效! –
增加了另外一個建議 – FunkTheMonk
請問您能解釋一下嗎? –