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

熱點內容
c編譯器使用說明 瀏覽:703
鄭州前端程序員私活有風險嗎 瀏覽:10
小型螺桿機壓縮機 瀏覽:516
成人解壓最好的方法 瀏覽:48
最小製冷壓縮機 瀏覽:488
xampp支持python 瀏覽:367
深圳周立功單片機 瀏覽:56
圓上點與點之間角度演算法 瀏覽:863
怎麼知道微信關聯了哪些app 瀏覽:696
android事件驅動 瀏覽:882
簽約大屏系統源碼 瀏覽:806
安卓系統怎麼轉入平板 瀏覽:425
安卓手機相機怎麼提取文字 瀏覽:219
如何查看伺服器映射的外網地址 瀏覽:985
圖片刺綉演算法 瀏覽:675
阿里雲伺服器沒有實例 瀏覽:605
綿陽有沒有什麼app 瀏覽:848
怎麼用游俠映射伺服器 瀏覽:921
為什麼無意下載的app無法刪除 瀏覽:306
word2007打開pdf 瀏覽:118