如何设置前景属性其它非的FrameLayout视图 [英] How to set foreground attribute to other non FrameLayout view

查看:151
本文介绍了如何设置前景属性其它非的FrameLayout视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道如何应用或模拟前景的影响来自的FrameLayout不同的视图,为的LinearLayout或RelativeLayout的

I would like to know how to apply or emulate foreground effect in a view different from FrameLayout, as LinearLayout or RelativeLayout

这是我现在有:

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cardContent"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/row_background"
    android:foreground="@drawable/foreground_row">

    ...

</FrameLayout>

和我想是这样的:

<?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/cardContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/row_background"
        app:foreground="@drawable/foreground_row">

        ...

    </RelativeLayout>

在此先感谢!

Thanks in advance!!

推荐答案

@Felipe

几个月前,我创造了这个库,比克里斯诅咒一个人好; - )

A few months ago I created this library, better than Chris Banes one ;-)

https://github.com/m3n0R/ForegroundViews

玩得开心!

这篇关于如何设置前景属性其它非的FrameLayout视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆