透明button 转
16lz
2021-01-23
设置一个按钮为透明,
(1)修改配置文件
<Button
android:id="@+id/btnAppMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="详细信息>>"
android:layout_alignParentRight="true"
android:layout_marginLeft="150dp"
android:background="@android:color/transparent"
/>
设置完透明按钮以后,发现按钮不见了……
(2)注意,按钮默认颜色同手机背景色(黑色)一样,按钮的文字默认也为黑色,这里,我们可以通过activity的oncreate()中设置一下按钮的字体颜色:
btn=(Button)findViewById(R.id.btnAppMore);
btn.setTextColor(Color.WHITE);
其实,透明也可以通过Java完成,嘎嘎,btn.setBackgroundColor(Color.TRANSPARENT);即可
(1)修改配置文件
<Button
android:id="@+id/btnAppMore"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="详细信息>>"
android:layout_alignParentRight="true"
android:layout_marginLeft="150dp"
android:background="@android:color/transparent"
/>
设置完透明按钮以后,发现按钮不见了……
(2)注意,按钮默认颜色同手机背景色(黑色)一样,按钮的文字默认也为黑色,这里,我们可以通过activity的oncreate()中设置一下按钮的字体颜色:
btn=(Button)findViewById(R.id.btnAppMore);
btn.setTextColor(Color.WHITE);
其实,透明也可以通过Java完成,嘎嘎,btn.setBackgroundColor(Color.TRANSPARENT);即可
更多相关文章
- 安卓开发之实现下角圆形按钮
- Android自定义dialog以及如何去除黑色背景
- 设置listview的背景颜色
- Android中按钮点击效果显示
- android 自定义按钮的外边框
- 点击LinearLayout使用selector改变TextView字体颜色
- Android抽屉式按钮实现
- Android 代码改变图片颜色android:tint="@color/main_color" and