最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android EditText設(shè)置邊框的操作方法

 更新時(shí)間:2023年12月19日 11:07:38   作者:tracydragonlxy  
這篇文章主要介紹了Android EditText設(shè)置邊框,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下

Android EditText設(shè)置邊框

簡介

Android應(yīng)用程序中給EditText設(shè)置邊框。

效果圖:

快速開始

1.在res/drawable目錄下新建樣式文件 edit_background.xml。

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item>
        <shape
            android:shape="rectangle">
            <solid android:color="#efefef"/>
            <corners android:radius="5dp"/>
            <stroke
                android:width="1dp"
                android:color="#505050"/>
        </shape>
    </item>

2.布局文件中使用邊框效果,/res/layout/activity_edit_text.xml。

android:background=“@drawable/edit_background”

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".EditTextActivity">
    <TextView
        android:id="@+id/name_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="賬號(hào):"
        android:textSize="18sp"
        android:textColor="#353535"
        android:layout_marginTop="60dp"
        android:layout_marginStart="60dp"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"/>
    <EditText
        android:id="@+id/edit_name"
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:hint="請輸入賬號(hào)"
        android:gravity="center"
        android:inputType="number"
        android:background="@drawable/edit_background"
        android:layout_marginStart="10dp"
        app:layout_constraintTop_toTopOf="@id/name_label"
        app:layout_constraintBottom_toBottomOf="@id/name_label"
        app:layout_constraintLeft_toRightOf="@id/name_label"/>
    <TextView
        android:id="@+id/pwd_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="密碼:"
        android:textSize="18sp"
        android:textColor="#353535"
        android:layout_marginTop="40dp"
        android:layout_marginStart="60dp"
        app:layout_constraintTop_toBottomOf="@id/name_label"
        app:layout_constraintLeft_toLeftOf="parent"/>
    <EditText
        android:id="@+id/edit_pwd"
        android:layout_width="200dp"
        android:layout_height="40dp"
        android:hint="請輸入密碼"
        android:gravity="center"
        android:inputType="textPassword"
        android:background="@drawable/edit_background"
        android:layout_marginStart="10dp"
        app:layout_constraintTop_toTopOf="@id/pwd_label"
        app:layout_constraintBottom_toBottomOf="@id/pwd_label"
        app:layout_constraintLeft_toRightOf="@id/pwd_label"/>
    <Button
        android:id="@+id/btn_login"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="ok"
        android:layout_marginTop="30dp"
        android:layout_marginStart="110dp"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintTop_toBottomOf="@id/pwd_label"/>
    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Cancel"
        android:layout_marginStart="50dp"
        app:layout_constraintTop_toTopOf="@id/btn_login"
        app:layout_constraintLeft_toRightOf="@id/btn_login"/>
</android.support.constraint.ConstraintLayout>

到此這篇關(guān)于Android EditText設(shè)置邊框的文章就介紹到這了,更多相關(guān)Android EditText邊框內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Android?SeekBar充當(dāng)Progress實(shí)現(xiàn)兔兔進(jìn)度條Plus

    Android?SeekBar充當(dāng)Progress實(shí)現(xiàn)兔兔進(jìn)度條Plus

    這篇文章主要為大家介紹了Android?SeekBar充當(dāng)Progress實(shí)現(xiàn)兔兔進(jìn)度條Plus示例,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-02-02
  • Android App中使用AudioManager類來編寫音頻播放器

    Android App中使用AudioManager類來編寫音頻播放器

    這篇文章主要介紹了Android App中使用AudioManager類來編寫音樂播放器的方法,文中舉了一個(gè)簡單的例子實(shí)現(xiàn)了基礎(chǔ)的播放暫停和靜音等功能,需要的朋友可以參考下
    2016-04-04
  • Android 高德地圖之poi搜索功能的實(shí)現(xiàn)代碼

    Android 高德地圖之poi搜索功能的實(shí)現(xiàn)代碼

    這篇文章主要介紹了android 高德地圖之poi搜索功能的實(shí)現(xiàn)代碼,在實(shí)現(xiàn)此功能時(shí)遇到很多問題,在文章都給大家提到,需要的朋友可以參考下
    2017-08-08
  • Android自定義水平進(jìn)度條的圓角進(jìn)度

    Android自定義水平進(jìn)度條的圓角進(jìn)度

    這篇文章主要為大家詳細(xì)介紹了Android自定義水平進(jìn)度條的圓角進(jìn)度,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2016-08-08
  • OkHttp原理分析小結(jié)

    OkHttp原理分析小結(jié)

    OkHttp 是 Square 公司開源的一款網(wǎng)絡(luò)框架,封裝了一個(gè)高性能的 http 請求庫,本文對(duì)OkHttp原理給大家詳細(xì)講解,感興趣的朋友跟隨小編一起看看吧
    2024-01-01
  • Jenkins打包android應(yīng)用時(shí)自動(dòng)簽名apk詳解

    Jenkins打包android應(yīng)用時(shí)自動(dòng)簽名apk詳解

    這篇文章主要介紹了Jenkins打包android應(yīng)用時(shí)自動(dòng)簽名apk詳解,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-07-07
  • Android實(shí)現(xiàn)通過手勢控制圖片大小縮放的方法

    Android實(shí)現(xiàn)通過手勢控制圖片大小縮放的方法

    這篇文章主要介紹了Android實(shí)現(xiàn)通過手勢控制圖片大小縮放的方法,結(jié)合實(shí)例形式分析了Android控制圖片縮放的原理、實(shí)現(xiàn)步驟與相關(guān)操作技巧,需要的朋友可以參考下
    2016-10-10
  • java反射android的r文件的示例

    java反射android的r文件的示例

    這篇文章主要介紹了java反射android的r文件的示例,動(dòng)態(tài)取得R文件的int值,需要的朋友可以參考下
    2014-04-04
  • Android?Flutter實(shí)現(xiàn)搜索的三種方式詳解

    Android?Flutter實(shí)現(xiàn)搜索的三種方式詳解

    這篇文章主要為大家詳細(xì)介紹了Android?Flutter實(shí)現(xiàn)搜索的三種方式,文中的示例代碼講解詳細(xì),具有一定的借鑒價(jià)值,感興趣的可以了解一下
    2022-08-08
  • Flutter開發(fā)之路由與導(dǎo)航的實(shí)現(xiàn)

    Flutter開發(fā)之路由與導(dǎo)航的實(shí)現(xiàn)

    這篇文章主要介紹了Flutter開發(fā)之路由與導(dǎo)航的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-12-12

最新評(píng)論

湖北省| 永吉县| 乳山市| 岑巩县| 黑河市| 弋阳县| 敦煌市| 崇信县| 政和县| 内乡县| 固镇县| 米泉市| 吉木乃县| 江西省| 南乐县| 望奎县| 太康县| 黑水县| 肇州县| 定兴县| 平江县| 收藏| 和林格尔县| 百色市| 眉山市| 盐亭县| 六盘水市| 普安县| 广宗县| 高阳县| 济源市| 奉节县| 九江县| 永宁县| 庄浪县| 宿松县| 沙河市| 武鸣县| 阳信县| 开封市| 清河县|