提升片段看

tyc*_*czj 2 android android-fragments

不太确定如何解释这个,但我怎么能让2个片段看起来像一个高于另一个片段,如图所示

在此输入图像描述

你可以看到它的右边缘listview比右边的碎片低.如何实现这一目标?我试图让我的布局看起来不那么一维/平.

Eri*_*ric 10

虽然Frank的答案很好,但你可以使用Android的内部gradientXML资源在没有图形的情况下实现这一点.

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:angle="180"
        android:centerX="0.1"
        android:startColor="#555"
        android:centerColor="#aaa"
        android:endColor="#aaa"
        android:type="linear" />
</shape>
Run Code Online (Sandbox Code Playgroud)
  • android:angle 说要从右到左水平地做
  • android:centerX 说要移动渐变的"中心",使其从渐变开始的10%.
  • android:startColor 是右侧显示的颜色.
  • android:centerColor 是在中心显示的颜色.
  • android:endColor是最后显示的颜色.这是centerColor因为除了阴影之外我们想要保持它的纯色.
  • android:type 显然,它是线性的.

我估计你会想要用颜色玩一下.