【问题标题】:Android : Gradient on relativelayout at bottom of screenAndroid:屏幕底部相对布局上的渐变
【发布时间】:2011-08-09 13:40:38
【问题描述】:

我想在底部布局上放一个渐变,但它似乎只适用于顶部布局。

这是主要布局的代码(test.xml):

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFF">
    <RelativeLayout android:id="@+id/relativeLayout1" android:layout_alignParentTop="true" android:layout_height="60sp" android:layout_width="fill_parent" android:background="@drawable/tool_bar_gradient"></RelativeLayout>
    <RelativeLayout android:id="@+id/relativeLayout2" android:layout_alignParentBottom="true" android:layout_height="60sp" android:layout_width="fill_parent" android:background="@drawable/tool_bar_gradient"></RelativeLayout>
</RelativeLayout>

渐变的代码(tool_bar_gradient):

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient xmlns:android="http://schemas.android.com/apk/res/android" android:startColor="#257aa1" android:endColor="#6fb7d9" android:angle="90" android:bottom="450sp">
    </gradient>
</shape>

结果:渐变在顶栏有效,但在底栏无效...

怎么了?

PS : 目标是 Android 2.1-update1 或 Android 2.2。

【问题讨论】:

    标签: android layout gradient shape


    【解决方案1】:

    我收到了

    screen i am getting

    是什么你没有得到它

    【讨论】:

    • 你说得对,它可以在运行时工作,但不能在 IDE 中运行。... IDE 中有一个错误,所以!感谢您花费的时间;)
    猜你喜欢
    • 2021-07-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-18
    • 1970-01-01
    相关资源
    最近更新 更多