欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Android編程實(shí)現(xiàn)圓角邊框布局效果的方法

 更新時(shí)間:2017年06月28日 10:14:02   作者:陶偉基Wiki  
這篇文章主要介紹了Android編程實(shí)現(xiàn)圓角邊框布局效果的方法,結(jié)合實(shí)例形式分析了Android TableLayout布局的相關(guān)屬性操作與圓角邊框?qū)崿F(xiàn)技巧,需要的朋友可以參考下

本文實(shí)例講述了Android編程實(shí)現(xiàn)圓角邊框布局效果的方法。分享給大家供大家參考,具體如下:

這里用的是TableLayout布局的。先看效果圖

下面看下布局文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#FFFFFF"
  android:orientation="vertical" >
  <!-- 表格布局 -->
  <TableLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:padding="10dip" >
    <!-- 表格布局:第一行 -->
    <TableRow
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="@drawable/shape_top_corner_no_bottom_line"
      android:padding="10dip" >
      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginRight="10dip"
        android:text="姓名:" >
      </TextView>
      <EditText
        android:id="@+id/bankingYourNameEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:background="@null"
        android:singleLine="true" >
      </EditText>
    </TableRow>
    <!-- 表格布局:第二行 -->
    <TableRow
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="@drawable/shape_no_corner_without_bottom"
      android:padding="10dip" >
      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginRight="10dip"
        android:text="聯(lián)系電話:" >
      </TextView>
      <EditText
        android:id="@+id/bankingContactTelEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:background="@null"
        android:inputType="phone"
        android:singleLine="true" >
      </EditText>
    </TableRow>
    <!-- 表格布局:第三行 -->
    <TableRow
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:background="@drawable/shape_bottom_corner_no_top_line"
      android:padding="10dip" >
      <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_marginRight="10dip"
        android:text="聯(lián)系電話:" >
      </TextView>
      <EditText
        android:id="@+id/bankingContactTelEditText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="1"
        android:background="@null"
        android:inputType="phone"
        android:singleLine="true" >
      </EditText>
    </TableRow>
  </TableLayout>
  <Button
    android:id="@+id/button1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:text="Button" />
</LinearLayout>

表格布局中每個(gè)TableRow表示一行,TableRow中的每個(gè)基本控件都是一列,這是一個(gè)三行兩列的布局

這里的表格背景是自定義的shape,下面分別看一下三個(gè)shape的代碼。

shape_top_corner_no_bottom_line.xml文件:頂部帶圓角 白色背景 灰色邊框 無下邊框 長(zhǎng)方體

<?xml version="1.0" encoding="UTF-8"?>
<!-- 頂部帶圓角 白色背景 灰色邊框 無下邊框 長(zhǎng)方體 -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <shape>
      <solid android:color="#FFFFFF" />
      <corners android:topLeftRadius="10dp" android:topRightRadius="10dp"
        android:bottomRightRadius="0.1dp" android:bottomLeftRadius="0.1dp" />
      <stroke android:width="1dp" android:color="#ffa8abad" />
    </shape>
  </item>
  <item android:top="1dp" android:left="1dp" android:right="1dp">
    <shape>
      <solid android:color="#FFFFFF" />
      <corners android:topLeftRadius="10dp" android:topRightRadius="10dp"
        android:bottomRightRadius="0.1dp" android:bottomLeftRadius="0.1dp" />
      <stroke android:width="1dp" android:color="#ffffffff" />
    </shape>
  </item>
</layer-list>

shape_no_corner_without_bottom.xml文件:不帶圓角 白色背景 灰色邊框 無下邊框 長(zhǎng)方體

<?xml version="1.0" encoding="UTF-8"?>
<!-- 不帶圓角 白色背景 灰色邊框 無下邊框 長(zhǎng)方體 -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
  <item>
    <shape>
      <solid android:color="#FFFFFF" />
      <stroke
        android:width="1dp"
        android:color="#ffa8abad" />
    </shape>
  </item>
  <item
    android:left="1dp"
    android:right="1dp"
    android:top="1dp">
    <shape>
      <solid android:color="#FFFFFF" />
      <stroke
        android:width="1dp"
        android:color="#ffffffff" />
    </shape>
  </item>
</layer-list>

shape_bottom_corner_no_top_line.xml文件:底部圓角 白色背景 灰色邊框 長(zhǎng)方體

<?xml version="1.0" encoding="UTF-8"?>
<!-- 底部圓角 白色背景 灰色邊框 長(zhǎng)方體 -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  <item>
    <shape>
      <solid android:color="#FFFFFF" />
      <corners android:topLeftRadius="0.1dp" android:topRightRadius="0.1dp"
        android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" />
      <stroke android:width="1dp" android:color="#ffa8abad" />
    </shape>
  </item>
  <item android:top="1dp" android:bottom="1dp" android:left="1dp" android:right="1dp">
    <shape>
      <solid android:color="#FFFFFF" />
      <corners android:topLeftRadius="0.1dp" android:topRightRadius="0.1dp"
        android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" />
      <stroke android:width="1dp" android:color="#ffffffff" />
    </shape>
  </item>
</layer-list>

更多關(guān)于Android相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《Android布局layout技巧總結(jié)》、《Android開發(fā)入門與進(jìn)階教程》、《Android調(diào)試技巧與常見問題解決方法匯總》、《Android基本組件用法總結(jié)》、《Android視圖View技巧總結(jié)》及《Android控件用法總結(jié)

希望本文所述對(duì)大家Android程序設(shè)計(jì)有所幫助。

相關(guān)文章

  • android自定義View滑動(dòng)刪除效果

    android自定義View滑動(dòng)刪除效果

    這篇文章主要為大家詳細(xì)介紹了android自定義控件View滑動(dòng)刪除效果,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-03-03
  • Android開發(fā)實(shí)現(xiàn)瀏覽器全屏顯示功能

    Android開發(fā)實(shí)現(xiàn)瀏覽器全屏顯示功能

    這篇文章主要介紹了Android開發(fā)實(shí)現(xiàn)瀏覽器全屏顯示功能,涉及Android布局修改及相關(guān)屬性動(dòng)態(tài)設(shè)置操作技巧,需要的朋友可以參考下
    2017-09-09
  • Android源碼中final關(guān)鍵字的用法及final,finally,finalize的區(qū)別

    Android源碼中final關(guān)鍵字的用法及final,finally,finalize的區(qū)別

    Android的源碼中很多地方對(duì)final關(guān)鍵字的用法很是“別出心裁”,之所以這么說是因?yàn)槲覐臎]看過是這么使用final關(guān)鍵字的,通過本文給大家分享Android源碼中final關(guān)鍵字的用法及final,finally,finalize的區(qū)別,感興趣的朋友一起學(xué)習(xí)吧
    2015-12-12
  • Android利用代碼控制設(shè)備上其他音樂播放器的方法

    Android利用代碼控制設(shè)備上其他音樂播放器的方法

    這篇文章主要給大家介紹了關(guān)于Android利用代碼如何控制設(shè)備上其他音樂播放器的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2018-06-06
  • Android框架Volley使用:ImageRequest請(qǐng)求實(shí)現(xiàn)圖片加載

    Android框架Volley使用:ImageRequest請(qǐng)求實(shí)現(xiàn)圖片加載

    這篇文章主要介紹了Android框架Volley使用:ImageRequest請(qǐng)求實(shí)現(xiàn)圖片加載的相關(guān)知識(shí),非常不錯(cuò),具有一定的參考借鑒價(jià)值 ,需要的朋友可以參考下
    2019-05-05
  • 簡(jiǎn)單實(shí)現(xiàn)Android讀取網(wǎng)絡(luò)圖片到本地

    簡(jiǎn)單實(shí)現(xiàn)Android讀取網(wǎng)絡(luò)圖片到本地

    這篇文章主要為大家詳細(xì)介紹了如何簡(jiǎn)單實(shí)現(xiàn)Android讀取網(wǎng)絡(luò)圖片到本地的方法,感興趣的小伙伴們可以參考一下
    2016-08-08
  • Android 完全退出當(dāng)前應(yīng)用程序的四種方法

    Android 完全退出當(dāng)前應(yīng)用程序的四種方法

    Android程序有很多Activity,比如說主窗口A,調(diào)用了子窗口B,如果在B中直接finish(), 接下里顯示的是A。在B中如何關(guān)閉整個(gè)Android應(yīng)用程序呢?本人總結(jié)了幾種比較簡(jiǎn)單的實(shí)現(xiàn)方法
    2016-02-02
  • Android簡(jiǎn)單實(shí)現(xiàn)無限滾動(dòng)自動(dòng)滾動(dòng)的ViewPager

    Android簡(jiǎn)單實(shí)現(xiàn)無限滾動(dòng)自動(dòng)滾動(dòng)的ViewPager

    這篇文章主要介紹了Android簡(jiǎn)單實(shí)現(xiàn)無限滾動(dòng)自動(dòng)滾動(dòng)的ViewPager,百度谷歌上面也有很多關(guān)于這方面的教程,但是感覺都略顯麻煩,而且封裝的都不是很徹底。所以試著封裝一個(gè)比較好用的ViewPager,實(shí)現(xiàn)思路一起通過本文學(xué)習(xí)吧
    2016-12-12
  • Android實(shí)現(xiàn)為Tab添加Menu的方法

    Android實(shí)現(xiàn)為Tab添加Menu的方法

    這篇文章主要介紹了Android實(shí)現(xiàn)為Tab添加Menu的方法,分析了兩種解決方法的思路并對(duì)比分析了相應(yīng)的優(yōu)缺點(diǎn),具有一定參考借鑒價(jià)值,需要的朋友可以參考下
    2016-10-10
  • Android使用ViewPager完成app引導(dǎo)頁

    Android使用ViewPager完成app引導(dǎo)頁

    這篇文章主要為大家詳細(xì)介紹了Android使用ViewPager完成app引導(dǎo)頁,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-11-11

最新評(píng)論