導航:首頁 > 操作系統 > 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文本框邊框相關的資料

熱點內容
三略pdf 瀏覽:582
spiflash單片機 瀏覽:9
阿里雲的域名怎麼解析到國外伺服器 瀏覽:281
app客戶端開發用什麼伺服器 瀏覽:289
台灣人能備案雲伺服器嗎雲空間 瀏覽:466
程序員小哥哥都喜歡動漫 瀏覽:372
如何用免費亞馬遜雲搭建伺服器 瀏覽:663
php評論功能實現代碼 瀏覽:526
犀牛中移動物件命令 瀏覽:786
程序員上班期間可以戴耳機嗎 瀏覽:255
伺服器啟動卡怎麼使用 瀏覽:794
逛了一天累趴了來一歌解壓句子 瀏覽:345
谷歌app在哪裡掃碼 瀏覽:989
華為手環加密門禁卡怎麼設置 瀏覽:732
pdf轉xlsx 瀏覽:96
nh3水溶液ph的演算法 瀏覽:483
pdf貓壓縮 瀏覽:49
數據挖掘分類演算法研究 瀏覽:101
河北航天發票認證伺服器地址 瀏覽:728
阿里程序員績效錄入 瀏覽:383