导航:首页 > 操作系统 > android按钮无边框

android按钮无边框

发布时间:2022-06-30 17:09:46

android怎么让button去掉边框

设置为无背景
android:background="@null"

❷ 安卓html元素被点击时产生的边框怎么去掉

在android手机中,当处于模块一状态时,用户触摸到“查看按钮”,a标签的边框显示出来,这明显不是我们要想要的体验。


最后跟产品经理沟通后,针对android手机去除上图的按钮边框,那么如何去除android手机自带的按钮边框呢?


在搜索引擎中找到资料-webkit-tap-highlight-color可以去除边框,如下图:


排除误解


网络资料说这个属性只用于iOS(iPhone和iPad),其实是错误的,android手机大部分也是支持的,只是显示效果不一样,移动开发并不成熟,更多的还需要大家去实践来辨别真伪- -


-webkit-tap-highlight-color用法


webkit内核的浏览器,当用户点击一个链接或者通过js定义的可点击元素的时候,会出现一个半透明的灰色背景或者红色的边框。


如果想要禁用高亮,可设置颜色的alpha值为0,也就是属性值的最后一位设置为0就可以去除背景或者边框。


去除android链接触摸时产生边框的css代码


a,button,input{-webkit-tap-highlight-color:rgba(255,0,0,0);}/* 1.去除android a/button/input标签被点击时产生的边框 2.去除ios a标签被点击时产生的半透明灰色背景 */

❸ android button边框怎么去掉

设置为无背景
android:background="@null"

方法二:
将背景改为
android:background="#00000000"

这里00000000为透明

❹ 为啥我的android studio没有边框

不会吧。是别人设置了边框宽度、内部间距的吧。看看我做的透明、圆角按钮。1. 先在res/drawable中定义一个shape.xml文件,具体的颜色你可以自己调 <...

❺ android如何去掉button的边框

将背景改为
android:background="#00000000"

这里00000000为透明

❻ 怎么给android 设置边框

总结一下android ui界面里面如何设置边框,以及如何把边框设置成弧形的即圆角。
其实,android的ui里,界面一般都是比较简单的,不会像web页面那样,数据量比较大,关于给android界面(表格)设置边框,其思想很想我们用HTML设计表格然后给它设置边框,如果你懂html的话。即通过给不同的控件设置背景颜色来反衬出边框线
以一个登录界面为例,设置一个有边框线的android 登录界面:
注:本例要求的只是将该TableLayout中的行与行之间用边框线隔开
此例中,采用TableLayout布局,非常简单,里面有3个TableRow,分别放置 用户名、密码、登录按钮,根据上面说的设置边框线只需要设置控件的背景颜色即可。这个例子中要求行与行之间有边框线,那么,就这么想,
TableLayout:是该界面的布局管理器(当然也是一个控件),放在最外层,那么这时你可以给它选一个背景颜色参考注释 a)
TableRow:是表格中的一行,设置边框线重点就在此,它是紧跟着TableLayout的,可以给TableRow(行)设置背景色,参考b)
TableLayout与TableRow关系:可以看成父与子的关系,那么不管怎么样,TableLayout总是大于TableRow,那么通过给二者设置不同的颜色,设置颜色的时候可以让子组件(TableRow)周围稍微留出一点边界(就是它的背景色不会覆盖完整个行,如何让它显示成这样呢=====>android:layout_margin="0.5dip"[此属性即是设置该组件周围留出一点边界])
<?xml version="1.0" encoding="UTF-8"?>
<TableLayout
android:id="@+id/widget30"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
xmlns:android="
android:background="#ffcccccc" //a)给tablelayout设置背景色,改背景颜色将会是你要设置的边框线的背景色
android:layout_margin="1dip"
>
<!--android:background="@drawable/view_shape" -->
<TableRow
android:id="@+id/widget40"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#ffffcc99" //b)给tablerow设置背景色
android:layout_margin="0.5dip" //c)非常重要的一点
>
<TextView
android:id="@+id/widget41"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login Name"
android:textStyle="bold"
android:layout_gravity="center_vertical" //如果想让表格里的列与列(column之间)也有边框线隔开,则同上面一样也要设置android:background="#ffffcc99"与android:layout_margin="0.5dip"
>
</TextView>
<EditText
android:id="@+id/widget42"
android:layout_width="141px"
android:layout_height="wrap_content"
android:textSize="18sp"
android:background="#ffffffff"
android:textColor="#ff000000"
>
</EditText>
</TableRow>
<TableRow
android:id="@+id/widget43"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:background="#ffffcc99"
android:layout_margin="0.5dip"
>
<TextView
android:id="@+id/widget44"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password"
android:textStyle="bold"
>
</TextView>
<EditText
android:id="@+id/widget45"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="18sp"
android:background="#ffffffff"
android:textColor="#ff000000"
>
</EditText>
</TableRow>
<Button
android:id="@+id/widget46"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Login"
android:textStyle="bold"
android:textColor="#ff000000"
android:layout_margin="2dip"
android:background="#ffffcc33"
>
<!--android:background="@drawable/view_shape" -->
</Button>
</TableLayout>

❼ android中去掉actionBar边框就像图中的问题有代码更好,谢谢各位大牛了

ActionBar是没有这条线的,你这个不是ActionBar吧,
你这个应该是自定义的控件吧
建议查看源代码,才知道怎么去掉

❽ android中为什么不显示EditText边框

不会吧。是别人设置了边框宽度、内部间距的吧。

看看我做的透明、圆角按钮。

1. 先在res/drawable中定义一个shape.xml文件,具体的颜色你可以自己调

<?xmlversion="1.0"encoding="UTF-8"?>
<shapexmlns:android="

android:shape="rectangle">
<!--填充的颜色:这里设置背景透明-->
<solidandroid:color="@android:color/transparent"/>
<!--边框的颜色:不能和窗口背景色一样-->
<stroke
android:width="3dp"
android:color="#ffffff"/>
<!--设置按钮的四个角为弧形-->
<!--android:radius弧形的半径-->
<cornersandroid: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="圆角按钮"/>


用上这句就OK啦:btn.setBackgroundResource(R.drawable.shape);
具体代码如下(不清楚你的布局是动态创建,还是使用已有的)

setContentView(R.layout.main);
//获取Activity的布局:注意你必须在main.xml中给LinearLayout设置id,比如:android:id="@+id/layout_main"
LinearLayout layout = (LinearLayout)

java">findViewById(R.id.layout_main);
//如果你的Layout也是动态创建的,那么创建布局LinearLayoutlayout=newLinearLayout(this);当然还要创建布局参数,最后addContentView
LinearLayout.LayoutParamsparams=newLinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
//---createabutton---
Buttonbtn=newButton(this);
btn.setText("圆角透明");
btn.setBackgroundResource(R.drawable.shape);
btn.setLayoutParams(params);
//---addsthebutton---
layout.addView(btn);
阅读全文

与android按钮无边框相关的资料

热点内容
文件夹怎么做标题 浏览:31
腾讯云服务器如何防止被攻击 浏览:879
六棱柱的体积算法 浏览:933
淘宝什么云服务器好用 浏览:340
pythonoa项目 浏览:307
android杜比音效 浏览:341
杀手47为什么连接不了服务器 浏览:108
静态路径命令 浏览:533
一直编译不过怎么办 浏览:829
汽车串联并联算法 浏览:458
助眠解压的声音音频小哥哥 浏览:277
pythoncmd换行 浏览:376
linux取消行号 浏览:355
安卓原生系统官网是什么 浏览:444
底部主图源码 浏览:878
服务器崩了有什么提示 浏览:780
远程海康服务器用什么浏览器 浏览:232
解压报纸图片 浏览:956
python微信公众号开发平台 浏览:895
知识付费网站java源码 浏览:255