[英]How do I can add a box show the image I click and eraser
well in android xml layout there is no box shadow attribute, thats why we use border or stroke, or you can create 2 boxes on top of each other with a little displacement to create shadow look, using layer-list this is boxshadow.xml drawable xml file, saved in res/drawable folder : 很好,在android xml布局中没有框阴影属性,这就是我们为什么使用边框或笔触的原因,或者您可以在彼此顶部创建2个框并稍加位移以创建阴影外观,使用layer-list这是boxshadow.xml drawable xml文件,保存在res / drawable文件夹中:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item >
<shape>
<corners android:radius="10dip" />
<gradient
android:angle="0"
android:endColor="#cccccc"
android:startColor="#4c4c4c" />
</shape>
</item>
<item android:bottom="3dp" android:right="3dp" android:left="3dp" android:top="3dp" >
<shape>
<corners android:radius="10dip" />
<gradient
android:angle="270"
android:centerColor="#f8d79b"
android:centerY="0.5"
android:endColor="#f8d79b"
android:startColor="#f8d79b" />
</shape>
</item>
</layer-list>
this is just an example and here is the result for this shape: 这只是一个示例,这是此形状的结果:
I used the xml file as background for a button in the activitylayout.xml like this: 我将xml文件用作activitylayout.xml中按钮的背景,如下所示:
<Button
android:layout_width="90dp"
android:layout_height="wrap_content"
android:text="Back"
android:id="@+id/button_back"
android:background="@drawable/boxshadow" />
of course you can use the same boxshadow.xml as a background for any other element such as TextView, EditText or ImageView. 当然,您可以将相同的boxshadow.xml用作任何其他元素(例如TextView,EditText或ImageView)的背景。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.