❶ 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);