導航:首頁 > 操作系統 > android文本框邊框

android文本框邊框

發布時間:2022-08-21 17:04:16

『壹』 android 如何讓edittext控制項顯示邊框

editText控制項,邊框其實是背景決定的,所以如果你的editText沒有邊框,可以通過以下兩種方式解決:

  1. 給editText設置一個帶邊框的背景,可以是shape繪制一個corner和solid,也可以是用一個切好的.9圖。

  2. 你應該是用的主題不對,把application的主題改成android:Theme.Light.NoTitleBar,editText的樣式應該是有邊框的那種了。

『貳』 怎麼給android 設置邊框

邊框主要是使用shape文件,可以定製左右上下的邊框,如果想要隱藏某部分,設置我透明即可。

『叄』 android中edittext控制項可以添加邊框嗎

可以。
1、將edittext的style設置成?android:attr/textViewStyle 取消掉默認的樣式,再設置background為@null
2、接下來就是一個空空的edittext了, 在兩個edittext中間加一個view,設置background為灰色,寬度match_parent,高度2dip。
代碼:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray" >

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/white"
android:orientation="vertical" >

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="輸入用戶名"
android:paddingBottom="5dip"
android:paddingTop="5dip" />

<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:color/darker_gray" />

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="輸入密碼"
android:inputType="textPassword"
android:paddingBottom="5dip"
android:paddingTop="5dip" />
</LinearLayout>

</RelativeLayout>

『肆』 如何設置textview的邊框

先寫drawable裡面的xml文件,裡面設置shape來設置文本框的特殊效果。

[java] view plain
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<!-- 實心 -->
<solid android:color="@android:color/white" />
<!-- 邊框 -->
<stroke
android:width="0.5dp"
android:color="@android:color/black" />
<!-- 圓角 -->
<corners android:radius="3dp" />
<!-- 邊距 -->
<padding
android:bottom="10dp"
android:left="10dp"
android:right="10dp"
android:top="10dp" />
<!-- 漸變 -->
<gradient
android:angle="270"
android:endColor="#FFFF782"
android:startColor="#13C7AF" />

</shape>

基本上常用的就這幾種了,要達到很好的效果,你需要重新細致的改寫裡面的數據。

下面是要用到這個shape的LineLayout,在裡面設置了3個TextView,沒設置對其的方式,默認是向做靠齊的。

[java] view plain
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/tvbar"
android:text="hello" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/tvbar"
android:text="hello" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/tvbar"
android:text="hello" />

</LinearLayout>

『伍』 怎麼給android 設置邊框

1.首先在res目錄下新建一個xml文件,類型選擇drawable,將自動生一個一個drawable文件(我用的sdk是android 4.1),並生成一個xml文件,在其中寫入以下代碼:
[java] view plain


<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >

<solid android:color="#FFFFFF" />

<stroke
android:width="0.01dp"
android:color="#FFFFFF" />

<padding
android:bottom="1dp"
android:left="0.5dp"
android:right="0.5dp"
android:top="0dp" />
</shape>

2.在要設置邊框的控制項xml命令里加入:android:background=「@drawable/boder」

『陸』 android 如何去掉edittext邊框

將edittext的style設置成?android:attr/textViewStyle取消掉默認的樣式,在設置background為@null接下來就是一個空空的edittext了(比如http://www.tiecou.com/)
,在兩個edittext中間加一個view,設置background為灰色,寬度match_parent,高度2dip看看。

RelativeLayoutxmlns:android="

xmlns:tools="

android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/darker_gray">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:background="@android:color/white"
android:orientation="vertical">

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="輸入用戶名"
android:paddingBottom="5dip"
android:paddingTop="5dip"/>

<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:color/darker_gray"/>

<EditText
style="?android:attr/textViewStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@null"
android:hint="輸入密碼"
android:inputType="textPassword"
android:paddingBottom="5dip"
android:paddingTop="5dip"/>
</LinearLayout>
</RelativeLayout>

『柒』 android4.2開發怎樣讓文本框有邊框

方法一:

比較土 ,加背景圖片,透明的帶邊框的背景圖片
設置到android:background就可以

方法二:
android:background的值是一個xml文件

yle="font-family: mceinline;">TextView的xml:

<TextView android:id="@+id/roomInfo"
android:layout_centerHorizontal="true"
android:textSize="24dip"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_alignParentRight="true"
android:textColor="@color/solid_black"
android:background="@drawable/setbar_bg"
android:layout_marginLeft="10dip"
android:layout_marginTop="5dip"
android:layout_width="300dip">
</TextView>

setbar_bg.xml 放在drawable-hdpi文件夾下面

<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00000000"/>
<stroke android:width="2dip" android:color="#ff000000" />
</shape>

『捌』 android中有文本框嗎設置為多行的EditText樣子不好

貌似4.0之後就是只有底線,而之前的版本樣式是都有邊框的,貌似的修改底層樣式

『玖』 怎麼給android 設置邊框

Android是一種基於Linux的自由及開放源代碼的操作系統,主要使用於移動設備,如智能手機和平板電腦。Android在開發過程中,很多情況下需要我們在TextView上面添加一個邊框,但是TextView本身不支持邊框,這里介紹幾種設置邊框的方法,可以供大家參考:

閱讀全文

與android文本框邊框相關的資料

熱點內容
imap命令失敗 瀏覽:318
編譯器設計心得體會 瀏覽:95
app反編譯程序 瀏覽:242
找一部美國電影男主偷自慰棒 瀏覽:205
免費電影投屏app哪個好 瀏覽:519
能看的那種網站 瀏覽:783
山東淄博市看房app哪個靠譜 瀏覽:831
師生情母親淚媽媽叫什麼 瀏覽:154
c工程中未調用的子函數會編譯嗎 瀏覽:194
0855神馬影視 瀏覽:651
安卓手機如何打開王牌競速 瀏覽:277
多音字命令 瀏覽:276
電影愛情動作 瀏覽:614
ipadpro怎麼安裝安卓軟體 瀏覽:274
穩健操盤指標源碼 瀏覽:663
可以免費看的視頻網站有哪些 瀏覽:148
excel文件怎麼轉換成pdf 瀏覽:79
衢州外賣app哪個用戶多 瀏覽:973
女主坐了五年牢男主報復女主 瀏覽:239
不用下載直接觀看網站 瀏覽:159