gpt4 book ai didi

Android 5 Lollipop 阴影方向或 y 偏移

转载 作者:太空宇宙 更新时间:2023-11-03 10:19:14 33 4
gpt4 key购买 nike

是否有可能改变 Y 偏移的阴影方向?

现在我有以下布局

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container"
android:layout_width="match_parent" android:layout_height="match_parent"
tools:context=".MainActivity" tools:ignore="MergeRootFrame" >

<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="200dp"
android:elevation="5dp"
android:translationZ="5dp"
android:background="@android:color/darker_gray"
android:layout_gravity="bottom"/>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="100dp"
android:elevation="4dp"
android:translationZ="5dp"
android:background="@android:color/holo_blue_dark"
android:layout_gravity="bottom"/>
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
android:elevation="3dp"
android:translationZ="5dp"
android:background="@android:color/holo_green_dark"
android:layout_gravity="bottom"/>

</FrameLayout>

重现了左边的结果,但我喜欢在右边的图像上实现效果 enter image description here

任何人都可以告诉我如何去做吗?

最佳答案

setOutlineProvider API 21 中添加的 View 方法可能有用。来自文档:

Sets the ViewOutlineProvider of the view, which generates the Outline that defines the shape of the shadow it casts, and enables outline clipping.

它确实允许自定义形状,但我不能 100% 确定可以更改阴影方向。

关于Android 5 Lollipop 阴影方向或 y 偏移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27582972/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com