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

button透明android

发布时间: 2022-04-27 17:03:57

A. android编程如何把现有的背景图片设置成透明的

方法一:
只要在配置文件内activity属性配置内加上

android:theme="@android:style/Theme.Translucent"

就好了。

这样就调用了android的透明样式!
方法二:
先在res/values下建colors.xml文件,写入:
<?xmlversionxmlversion="1.0"encoding="UTF-8"?>

<resources>

<colornamecolorname="transparent">#9000</color>

</resources>
这个值设定了整个界面的透明度,为了看得见效果,现在设为透明度为56%(9/16)左右。

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

设置Android中控件的颜色透明度,可自由设置在layout里也可以在activity里
eclipse

1

#ff000000 此为16进制颜色代码,
前2位ff为透明度,后6位为颜色值(000000为黑色,ffffff为白色,可以用ps等软件获取)。
2
透明度分为256阶(0-255),计算机上用16进制表示为(00-ff)。透明就是0阶,不透明就是255阶,如果50%透明就是127阶(256的一半当然是128,但因为是从0开始,所以实际上是127)。
3
10进制的255换算成16进制是ff,127换算成16进制是7f,#7f000000 代表50%透明度的黑色。 (写成#50000000当然是不行的)进制转换可使用win7自带计算器(转为科学型)。例:25%透明度的一种红色“#3ff70000

C. 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"
/>

D. Android 当给一个button设置一个透明背景后 文字不见了 怎么解决

你可以把Button的background属性设为 “@null” 。 如果字不显示,就设置下字的颜色textColor

E. 请教android怎么让控件背景透明

以Android Studio为例,步骤如下:

1、直接打开相关窗口,在Android-app-res-layout的空白处点击鼠标右键并选择New-Layoutresource file。

F. 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" />

G. 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透明度值

H. android Button背景是透明,很难点到 ,附图,在不改变这图片背景可以更改么,财经那地方的那个小箭头

首先你哪个button是坐什么用的 看看能不能把button换个地方显示 你不觉得button和哪个财经两个字重叠了不是很美观么

I. Android 当给一个button设置一个透明背景后 ,文字不见了 怎么解决

android:background="#00000000" />
用这个试试看吧,我以前用透明都是用这个属性。
你我找个按钮试验下,你先用这个试试
刚才试验了下,我的没为题,估计是你代码出问题了,打印信息,看看你的BUTTON监听里有没有输出

J. android怎么设置button半透明

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

热点内容
配置中心应急流程有哪些 发布:2025-05-15 02:37:31 浏览:669
php宏定义 发布:2025-05-15 02:32:54 浏览:270
咸鱼支付密码哪里改 发布:2025-05-15 02:32:53 浏览:520
存储机箱 发布:2025-05-15 02:31:31 浏览:836
编程很累吗 发布:2025-05-15 02:29:25 浏览:552
疫情期间访问国外网络 发布:2025-05-15 02:24:24 浏览:247
我的世界网易版游戏服务器 发布:2025-05-15 02:23:46 浏览:221
全球编程网站 发布:2025-05-15 02:22:55 浏览:334
编程猫知乎 发布:2025-05-15 02:18:00 浏览:631
服务器转接搭建 发布:2025-05-15 02:12:50 浏览:518