Android 底部布局上的渐变形状背景
下面是一些我不理解的UI行为 我想要的是: 我得到的是: 我的代码:Android 底部布局上的渐变形状背景,android,background,gradient,shape,Android,Background,Gradient,Shape,下面是一些我不理解的UI行为 我想要的是: 我得到的是: 我的代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <FrameLa
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/black_to_white" />
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/blue_to_red" />
</LinearLayout>
背景代码:(除颜色外,两者代码相同)
如何使第二个渐变从屏幕中间开始变为蓝色
(我注意到渐变在android 3.0的查看模式下运行良好,但在其他版本上不起作用)我正在使用以下代码,它可以根据需要正常工作
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient
android:startColor="#151B8D"
android:endColor="#ff0000"
android:angle="270" />
</shape>
问题是您的颜色代码中缺少alpha:
#[alpha][red][green][blue]
如果您为drawable不工作提供xml,那就更好了。另外,您是否已经尝试在两个框架布局中使用相同的黑白背景?
#[alpha][red][green][blue]