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

Android開發(fā)菜單布局之表格布局示例

 更新時間:2019年04月17日 14:08:08   作者:水中魚之1999  
這篇文章主要介紹了Android開發(fā)菜單布局之表格布局,結(jié)合具體實(shí)例形式分析了Android菜單布局中表格布局的相關(guān)行列排版與設(shè)置操作技巧,需要的朋友可以參考下

本文實(shí)例講述了Android開發(fā)菜單布局之表格布局。分享給大家供大家參考,具體如下:

多用于靜態(tài)菜單頁面

xml代碼

代碼內(nèi)帶詳細(xì)解釋

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
  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:id="@+id/root"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:orientation="vertical">
  <!--分別以0,1,2 對應(yīng) 1,2,3列-->
  <!--定義第 1 個表格布局,第二列收縮第三列拉伸-->
  <TableLayout
    android:id="@+id/TableLayout01"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:shrinkColumns="1"
    android:stretchColumns="2">
    <!--第一行不使用TableRow自己會占一行-->
    <Button
      android:id="@+id/ok1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="第一行不使用TableRow自己會占一行"/>
    <!--添加一個表格-->
    <TableRow>
      <Button
        android:id="@+id/ok2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="無設(shè)置 按鈕"/>
      <Button
        android:id="@+id/ok3"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="收縮的 按鈕"/>
      <Button
        android:id="@+id/ok4"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拉伸的 按鈕"/>
    </TableRow>
  </TableLayout>
  <!--定義第 2 個表格布局,第二列隱藏-->
  <TableLayout
    android:id="@+id/TableLayout02"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:collapseColumns="1">
    <!--第一行不使用TableRow自己會占一行-->
    <Button
      android:id="@+id/ok5"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="第一行不使用TableRow自己會占一行"/>
    <!--添加一個表格-->
    <!--由于設(shè)置collapseColumns="1"故第二列隱藏-->
    <TableRow>
      <Button
        android:id="@+id/ok6"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="按鈕1"/>
      <Button
        android:id="@+id/ok7"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="按鈕2"/>
      <Button
        android:id="@+id/ok8"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="按鈕3"/>
    </TableRow>
  </TableLayout>
  <!--定義第 3 個表格布局,第二列和第三列拉伸-->
  <!--多行花式設(shè)計(jì)-->
  <TableLayout
    android:id="@+id/TableLayout03"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:stretchColumns="1,2">
    <!--第一行不使用TableRow自己會占一行-->
    <Button
      android:id="@+id/ok9"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="第一行不使用TableRow自己會占一行"/>
    <!--添加一個表格-->
    <!--由于設(shè)置collapseColumns="1"故第二列隱藏-->
    <TableRow>
      <Button
        android:id="@+id/ok10"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="無設(shè)置 按鈕"/>
      <Button
        android:id="@+id/ok11"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拉伸的 按鈕"/>
      <Button
        android:id="@+id/ok14"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拉伸的 按鈕"/>
    </TableRow>
    <!--第二行單列-->
    <TableRow>
    <Button
      android:id="@+id/ok15"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="無設(shè)置 按鈕"/>
      <Button
        android:id="@+id/ok16"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="拉伸的 按鈕"/>
  </TableRow>
    <TableRow>
    <Button
      android:id="@+id/ok17"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:text="無設(shè)置 按鈕"/>
  </TableRow>
  </TableLayout>
</LinearLayout>

效果圖:

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

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

相關(guān)文章

  • Android異常處理最佳實(shí)踐

    Android異常處理最佳實(shí)踐

    這篇文章主要為大家詳細(xì)介紹了Android異常處理最佳實(shí)踐,介紹了一個優(yōu)秀的app異常處理機(jī)制包括什么,感興趣的小伙伴們可以參考一下
    2016-03-03
  • Android利用Espresso進(jìn)行UI自動化測試的方法詳解

    Android利用Espresso進(jìn)行UI自動化測試的方法詳解

    因?yàn)槲沂歉鉧ndroid開發(fā)的,所以被分到了自動化測試小組,所以了解了一些UI自動化測試。下面這篇文章主要給大家介紹了關(guān)于Android利用Espresso進(jìn)行UI自動化測試的相關(guān)資料,需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-12-12
  • Android NoSuchFieldError解決辦法

    Android NoSuchFieldError解決辦法

    這篇文章主要介紹了Android NoSuchFieldError解決辦法的相關(guān)資料,希望通過本文能幫助到大家,需要的朋友可以參考下
    2017-10-10
  • Android仿微信多人音視頻通話界面

    Android仿微信多人音視頻通話界面

    這篇文章主要為大家詳細(xì)介紹了Android仿微信多人音視頻通話界面,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-07-07
  • Android Https證書過期的兩種解決方案

    Android Https證書過期的兩種解決方案

    應(yīng)該有很多小伙伴遇到這樣一個問題,在線上已發(fā)布的app里,關(guān)于https的cer證書過期,從而導(dǎo)致app所有網(wǎng)絡(luò)請求失效無法使用,這篇文章主要介紹了Android Https證書過期的解決方案,需要的朋友可以參考下
    2022-12-12
  • Flutter中數(shù)據(jù)存儲的四種方式小結(jié)

    Flutter中數(shù)據(jù)存儲的四種方式小結(jié)

    在 Flutter 中,存儲是指用于本地和遠(yuǎn)程存儲和管理數(shù)據(jù)的機(jī)制,本給大家介紹了Flutter中不同存儲選項(xiàng)的概述和示例,通過代碼示例講解的非常詳細(xì),具有一定的參考價值,需要的朋友可以參考下
    2023-11-11
  • android上實(shí)現(xiàn)0.5px線條的原理分析

    android上實(shí)現(xiàn)0.5px線條的原理分析

    這篇文章主要介紹了android上實(shí)現(xiàn)0.5px線條的原理分析,本文通過實(shí)例代碼給大家介紹的非常詳細(xì),對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2021-01-01
  • Android 處理 View 重復(fù)點(diǎn)擊的多種方法

    Android 處理 View 重復(fù)點(diǎn)擊的多種方法

    這篇文章主要介紹了Android 處理 View 重復(fù)點(diǎn)擊的多種方法,幫助大家更好的理解和學(xué)習(xí)使用Android,感興趣的朋友可以了解下
    2021-03-03
  • 詳解Android觀察者模式的使用與優(yōu)劣

    詳解Android觀察者模式的使用與優(yōu)劣

    這篇文章主要介紹了Android觀察者模式的相關(guān)資料,幫助大家更好的理解和學(xué)習(xí)Android的設(shè)計(jì)模式,感興趣的朋友可以了解下
    2020-09-09
  • APK包名修改 請問如何修改APK包名

    APK包名修改 請問如何修改APK包名

    今天,想在android手機(jī)上安裝兩個相同的應(yīng)用,本以為可以安裝不同版本的,試了幾次,均相互覆蓋了,于是,只能設(shè)法修改apk所對應(yīng)的包名(package name),需要了解的朋友可以參考下
    2012-12-12

最新評論

治县。| 威海市| 朝阳市| 瑞安市| 平和县| 中方县| 饶平县| 东光县| 龙陵县| 专栏| 双鸭山市| 武鸣县| 桐庐县| 伊川县| 长垣县| 砀山县| 澄江县| 桐庐县| 东丰县| 边坝县| 冀州市| 卫辉市| 华安县| 永新县| 马鞍山市| 葵青区| 新巴尔虎右旗| 石棉县| 安龙县| 平谷区| 金堂县| 喀喇| 祁连县| 望江县| 乌兰浩特市| 宜兰县| 遂川县| 岑溪市| 汽车| 饶阳县| 大关县|