android按钮阴影效果图,android – 如何设置按钮有图像和阴影?
要制作阴影,制作阴影xml文件并使用像android:background =“@ drawable / shadow”.但是把图像放到android:background =“@ drawable / image也是如此.如何在一个按钮中设置按钮阴影和图像?对不起,我的英语不流利.解决方法:1.使用ImageButton试试这个你可以使用ImageButton: – 显示一个按钮,其中包含可以被
要制作阴影,制作阴影xml文件并使用像android:background =“@ drawable / shadow”.
但是把图像放到android:background =“@ drawable / image也是如此.
如何在一个按钮中设置按钮阴影和图像?
对不起,我的英语不流利.
解决方法:
1.使用ImageButton
试试这个你可以使用ImageButton: – 显示一个按钮,其中包含可以被用户按下或点击的图像(而不是文本).默认情况下,ImageButton看起来像常规Button,标准按钮背景在不同按钮状态下改变颜色.
android:id="@+id/btnMain"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:contentDescription="@string/btnMain_description"
android:elevation="10dp"
android:background="@android:drawable/dialog_holo_light_frame"
android:scaleType="centerInside"
android:src="@drawable/IMage"
/>
2.用户CardVirew
或者您可以尝试在卡片视图中添加您的按钮,就像这样
编译这个依赖项
compile 'com.android.support:cardview-v7:25.3.1'
像这样的布局
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:cardElevation="10dp">
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/disha"
android:text="@string/app_name" />
如果有任何疑问,请问我
标签:android,android-layout,android-button
来源: https://codeday.me/bug/20190622/1264463.html
更多推荐
所有评论(0)