当前位置:首页 » 安卓系统 » android透明按钮

android透明按钮

发布时间: 2022-09-27 03:42:12

㈠ android button按钮按下时为什么变透明了

android 按钮按下变成透明了应该是添加了点击的背景图片,可以使用一些xml文件设置点击、按下、弹起的图片的。

㈡ android Button 怎么把背景设置透明

Android控件设置边框,或者背景可以使用XML来配置,背景透明只需要设置solid 的值为 #00000000即可,前面两位是透明度,后面6位是RGB颜色值,具体示例代码如下:
1.在drawable新建一个 buttonstyle.xml的文件,内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<!-- 连框颜色值 --><item>
<shape>
<solid android:color="#ff0000" />
</shape>
</item>
<!-- 主体背景颜色值 -->
<item android:bottom="3dp" android:right="3dp">
<shape>
<solid android:color="#ffffff" />
<padding android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
</item>
</layer-list>

2.然后在布局文件里面引入这个xml,示例代码如下:
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1"
android:background="@drawable/buttonstyle" />

㈢ android开发 设置自定义按钮为半透明

半透明<Button android:background="#e0000000" ... />
透明<Button android:background="#00000000" ... />
颜 色和不透明度 (alpha) 值以十六进制表示法表示。任何一种颜色的值范围都是 0 到 255(00 到 ff)。对于 alpha,00 表示完全透明,ff 表示完全不透明。表达式顺序是“aabbggrr”,其中“aa=alpha”(00 到 ff);“bb=blue”(00 到 ff);“gg=green”(00 到 ff);“rr=red”(00 到 ff)。例如,如果您希望对某叠加层应用不透明度为 50% 的蓝色,则应指定以下值:7fff0000
设置背景图片透明度(超简单)
Java代码
View v = findViewById(R.id.content);//找到你要设透明背景的layout 的id
v.getBackground().setAlpha(100);//0~255透明度值

㈣ android 为什么button是半透明的

在main.xml里面加入如下代码,就可以Android中按钮如何设置透明或半透明;
<Button
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
/>

㈤ 如何设置Android中控件的颜色透明度

Android中设置ImageView控件的图片的透明度应该调用View的api,以下为示例:
1、用android系统的透明效果
Java代码
android:background="@android:color/transparent"
例如 设置按钮
Java代码
<Button android:background="@android:color/transparent"
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#ffffff" />
2、用ARGB来控制
Java代码
半透明<Button android:background="#e0000000" />
透明<Button android:background="#00000000" />
3、设置alpha
Java代码
View v = findViewById(R.id.content);
v.getBackground().setAlpha(100);
说明: 0~255透明度值,0表示完全不透明,255表示完全透明。

㈥ android代码的形式让button变成圆角 透明,如图

步骤如下:
------------------------------------------------------------------------
1. 先在res/drawable中定义一个shape.xml文件,具体的颜色你可以自己调
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle" >

<!-- 填充的颜色:这里设置背景透明 -->
<solid android:color="@android:color/transparent" />
<!-- 边框的颜色 :不能和窗口背景色一样-->
<stroke
android:width="3dp"
android:color="#ffffff" />
<!-- 设置按钮的四个角为弧形 -->
<!-- android:radius 弧形的半径 -->
<corners android:radius="5dip" />

<!-- padding:Button里面的文字与Button边界的间隔 -->
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
</shape>
------------------------------------------------------------------------
2. 在你的Activity的xml(比如activity_main.xml)中定义按钮
<Button
android:id="@+id/roundButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape"
android:text=" 圆角按钮 " />

㈦ android 按钮半透明怎么做

在main.xml里面加入如下代码,就可以Android中按钮如何设置透明或半透明;
<Button
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
/>

㈧ Android按钮变透明了

死别已吞声,生别常恻恻。
江南瘴疠地,逐客无消息。
故人入我梦,明我常相忆。
君今在罗网,何以有羽翼?
恐非平生魂,路远不可测。
魂来枫林青,魂返关塞黑。
落月满屋梁,犹疑照颜色。
水深波浪阔,无使蛟龙得。

㈨ Android中按钮如何设置透明或半透明,求代码

在main.xml里面加入如下代码,就可以Android中按钮如何设置透明或半透明;
<Button
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#00000000"
/>

㈩ android怎么设置button半透明

在设置setBackgroundColor之前,调用 Drawable drawable = button.getBackground(); button.setBackgroundColor(0xffff77777); 把drawable 保存起来,然后,恢复: button.setBackgroundDrawable(drawable); 我试过了,可以。

热点内容
修罗云服务器 发布:2024-05-06 18:05:18 浏览:708
什么电脑可以安装安卓系统 发布:2024-05-06 18:05:15 浏览:778
金标顶配都有哪些配置 发布:2024-05-06 17:58:22 浏览:599
怎么看配置高低是否换电脑 发布:2024-05-06 17:32:01 浏览:968
linux命令查看目录 发布:2024-05-06 17:24:18 浏览:531
sqlvb 发布:2024-05-06 17:24:16 浏览:227
分镜头脚本软件 发布:2024-05-06 17:22:54 浏览:824
华为手机百度的缓存如何清理 发布:2024-05-06 17:22:53 浏览:941
网投源码 发布:2024-05-06 17:10:35 浏览:871
看门狗脚本 发布:2024-05-06 17:10:28 浏览:108