定制的LinearLayout [英] Custom LinearLayout

查看:235
本文介绍了定制的LinearLayout的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要像以下布局:

有关,我需要3个背景是这样的:

我将需要结合所有这些,

在运行时我不得不改变每一个背景颜色

所以我想进行自定义的LinearLayout。

但我不知道如何使它这样。

我已经检查使三角形和平行四边形布局的一些例子,但我也想合并所有三种观点。请给一些有用的链接,也给$ ​​C $ C的例子,而不是给引用。

感谢你在前进。 :)

我试图在相对布局。对于远程视窗,我想这样的:

  Col​​orFilter CF =新PorterDuffColorFilter(-15032095,Mode.MULTIPLY);
        绘制对象D = context.getResources()getDrawable(R.drawable.panel1)。
        d.mutate();
        d.setColorFilter(CF);
 

我试过低于codeS:

  rv.setInt(R.id.rl_noti_main,setColorFilter,D);
rv.setInt(R.id.rl_noti_main,setBackgroundDrawable,-15032095);
rv.setInt(R.id.rl_noti_main,setBackgroundResources,D);
 

解决方案

尝试框架布局或相对布局。需要重叠视图来实现这一不能在线性布局来完成。使每个图像的矩形透明区域哪一部分需要重叠。

I want to make layout like following :

For that i will need three backgrounds like this:

I will need to combine all of them and

at runtime i have to change background color of each

so i thought to make custom linearlayout.

But I don't know how to make it like that.

I have checked some example of making triangular and parallelogram layout but i want to merge all three views also. Please give some useful links and also give code example rather than giving references.

Thank you in Advance. :)

I tried in relative layout. for remoteview, i tried this:

ColorFilter cf = new PorterDuffColorFilter(-15032095, Mode.MULTIPLY);
        Drawable d= context.getResources().getDrawable(R.drawable.panel1);
        d.mutate();
        d.setColorFilter(cf);

I tried below codes:

rv.setInt(R.id.rl_noti_main, "setColorFilter", d);
rv.setInt(R.id.rl_noti_main, "setBackgroundDrawable", -15032095);
rv.setInt(R.id.rl_noti_main, "setBackgroundResources",d);

解决方案

try frame layout or relative layout. you need to overlap each view to achieve this which can't be done in linear layout. make each image as rectangle with transparent area which part need to overlap.

这篇关于定制的LinearLayout的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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