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
请问您能解释一下吗? –