对于想了解android–带有@null背景的图像按钮(透明)[复制]的读者,本文将提供新的信息,我们将详细介绍android:background="@null",并且为您提供关于AndroidEd
对于想了解android – 带有@null背景的图像按钮(透明)[复制]的读者,本文将提供新的信息,我们将详细介绍android:background="@null",并且为您提供关于Android EditText android:background="@null"、Android WebView 样式背景颜色:在 android 2.2 上忽略透明、android – 9个补丁图像作为背景的问题、android – 以编程方式调整图像按钮的边距,高度和宽度的有价值信息。
本文目录一览:- android – 带有@null背景的图像按钮(透明)[复制](android:background="@null")
- Android EditText android:background="@null"
- Android WebView 样式背景颜色:在 android 2.2 上忽略透明
- android – 9个补丁图像作为背景的问题
- android – 以编程方式调整图像按钮的边距,高度和宽度
android – 带有@null背景的图像按钮(透明)[复制](android:background="@null")
参见英文答案 > How to set image button backgroundimage for different state? 10个
我有一个带有透明度的图像源的图像按钮,但图像按钮的背景颜色是典型的灰色按钮颜色.
我想设置背景= @null,这很好.
但是,当我按下此图像按钮时,我看不到表示我按下按钮的颜色.
如果我在按下按钮时删除background = @null,请更改用户知道您按下的颜色.
我读到你可以创建一个带有3个图像的xml,指定按下按钮的时间,此正常情况以及何时聚焦.但我认为存在一种更容易的方法.
解决方法:
根据上述答案,使用选择器drawable(对于背景,而不是null)将默认状态设置为透明颜色:
* selector_with_transparency:*
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:state_pressed="true" android:drawable="@drawable/pressed" />
<item android:drawable="@drawable/transparent" />
</selector>
按:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#0077cc" />
</shape>
透明:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#00000000"/>
</shape>
然后为ImageButton:
background = "@drawable/selector_with_transparency"
Android EditText android:background="@null"
Android EditText android:background="@null" 在模拟器上背景为
可是在真机上就变成了这样:
这个是为什么啊?
Android WebView 样式背景颜色:在 android 2.2 上忽略透明
我正在努力创建一个具有透明背景的 WebView。
webView.setBackgroundColor(0x00FFFFFF);
webView.setBackgroundDrawable(myDrawable);
然后我加载一个html页面
<body...
WebView 的背景颜色是透明的,但一旦加载页面,它就会被 html 页面的黑色背景覆盖。这只发生在 android 2.2 上,它适用于 android
2.1。
那么是否需要在 html 页面代码中添加一些内容以使其真正透明?
android – 9个补丁图像作为背景的问题
奇数/偶数元素的交替背景图像.我想设定
通过计算位置动态绘制背景.它
正常位图正常工作.但是当我试图使用
ninepatch图像它打破了UI,所有的元素都被扭曲了.什么
我做错了吗这可能是如何创建或创建ninepatch图像
与正常情况相比,使用ninepatch图像有一种不同的方式
位图.
我的列表视图XML就是这样的
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/id01" android:background="@drawable/my_9patch_bg_image"> <ImageView /> <RelativeLayout> <ImageView /> <TextView /> <TextView /> </RelativeLayout> </RelativeLayout>
可能解决方案here可能为我的问题工作.这是确切的,虽然我必须尝试.
解决方法
我有同样的问题,你需要设置为零(即使你不需要它).
祝你好运.
android – 以编程方式调整图像按钮的边距,高度和宽度
这与屏幕尺寸的设备.
如何以编程方式设置 ImageButton的宽度,高度和边距?
解决方法
//ImageView Setup ImageView imageView = new ImageView(this); //setting height and width of imageview LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT); //setting margins around imageimageview params.setMargins(10,10,10); //left,top,right,bottom //adding attributes to the imageview imageView.setLayoutParams(params);
今天关于android – 带有@null背景的图像按钮(透明)[复制]和android:background="@null"的分享就到这里,希望大家有所收获,若想了解更多关于Android EditText android:background="@null"、Android WebView 样式背景颜色:在 android 2.2 上忽略透明、android – 9个补丁图像作为背景的问题、android – 以编程方式调整图像按钮的边距,高度和宽度等相关知识,可以在本站进行查询。
本文标签: