添加阴影在布局的右侧和底部 [英] Add shadow on right and bottom side of the layout

查看:874
本文介绍了添加阴影在布局的右侧和底部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在右边和layout.I的底部添加光影使用 Android的尝试:背景=@机器人:可绘制/ dialog_holo_light_frame,但它增加了一层厚厚的阴影在layout.What四边绘制的,我需要创建并设置为背景?

 < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android    机器人:layout_width =match_parent
    机器人:layout_height =WRAP_CONTENT
    机器人:方向=垂直
    机器人:背景=@机器人:可绘制/ dialog_holo_light_frame>
       < ImageView的
                机器人:ID =@ + ID / G
                机器人:layout_width =WRAP_CONTENT
                机器人:layout_height =WRAP_CONTENT
                机器人:scaleType =centerCrop
                机器人:layout_gravity =中心
                机器人:SRC =@绘制/ logo_icon
                机器人:知名度=看得见
                机器人:可点击=真/>
< / LinearLayout中>


解决方案

这就是我所指和它的工作。

1.新增**一个普通的LinearLayout与灰色,在其底部和右侧等于1或2个DP添加您的实际布局,保证金

2.具有与阴影的9片图像,并将其设置为背景,以您的线性布局**

<一个href=\"http://stackoverflow.com/questions/13005714/how-to-show-shadow-around-the-linearlayout-in-android\">Other这里解决方案

I want to add a light shadow on the right and bottom side of the layout.I tried using android:background="@android:drawable/dialog_holo_light_frame" but it adds a thick shadow on all four sides of the layout.What drawable i need to create and set as background?

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:background="@android:drawable/dialog_holo_light_frame">
       <ImageView
                android:id="@+id/g"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="centerCrop"
                android:layout_gravity="center"
                android:src="@drawable/logo_icon"
                android:visibility="visible"
                android:clickable="true" />
</LinearLayout>

解决方案

This is what I referred and it worked.

** 1.Add a plain LinearLayout with grey color, over which add your actual layout, with margin at bottom and right equal to 1 or 2 dp

2.Have a 9-patch image with a shadow and set it as the background to your Linear layout**

Other solutions here

这篇关于添加阴影在布局的右侧和底部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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