當前位置:首頁 » 安卓系統 » android文本框邊框

android文本框邊框

發布時間: 2022-08-19 04:38:51

㈠ 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控制項顯示邊框

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

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

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

㈢ 怎麼給android 設置邊框

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

㈣ 怎麼給android 設置邊框

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

㈤ 如何設置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中有文本框嗎設置為多行的EditText樣子不好

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

㈦ 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>

㈧ 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>

熱點內容
ios儲存密碼哪裡看 發布:2024-09-08 09:30:02 瀏覽:869
opensslcmake編譯 發布:2024-09-08 09:08:48 瀏覽:653
linux下ntp伺服器搭建 發布:2024-09-08 08:26:46 瀏覽:744
db2新建資料庫 發布:2024-09-08 08:10:19 瀏覽:173
頻率計源碼 發布:2024-09-08 07:40:26 瀏覽:780
奧迪a6哪個配置帶後排加熱 發布:2024-09-08 07:06:32 瀏覽:101
linux修改apache埠 發布:2024-09-08 07:05:49 瀏覽:209
有多少個不同的密碼子 發布:2024-09-08 07:00:46 瀏覽:566
linux搭建mysql伺服器配置 發布:2024-09-08 06:50:02 瀏覽:995
加上www不能訪問 發布:2024-09-08 06:39:52 瀏覽:811