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

Android布局之GridLayout網(wǎng)格布局

 更新時間:2015年12月31日 10:53:39   作者:會飛的一只狼  
網(wǎng)格布局標簽是GridLayout。這個布局是android4.0新增的布局。這個布局只有4.0之后的版本才能使用。本文給大家介紹Android布局之GridLayout網(wǎng)格布局相關(guān)知識,感興趣的朋友一起學習吧

網(wǎng)格布局標簽是GridLayout。這個布局是android4.0新增的布局。這個布局只有4.0之后的版本才能使用。

不過新增了一些東東

①跟LinearLayout(線性布局)一樣,他可以設(shè)置容器中組件的對齊方式

②容器中的組件可以跨多行也可以跨多列(相比TableLayout直接放組件,占一行相比較)

因為是android 4.0新增的,API Level 14,在這個版本以前的sdk

都需要導入項目,等下會詳細介紹

常用屬性:

排列對齊:

①設(shè)置組件的排列方式:   android:orientation=""     vertical(豎直,默認)或者horizontal(水平)

②設(shè)置組件的對齊方式:   android:layout_gravity=""   center,left,right,buttom啊,這些,如果想同時用兩種的話:eg: buttom|left

學習導圖

(一)簡介

  網(wǎng)格布局由GridLayout所代表,在android4.0之后新增加的布局管理器,因此需要android4.0之后的版本中使用,如果在更早的平臺使用該布局管理器,則需要導入相應的支持庫<android.support.v7.widget.GridLayout>

(二)案列----計算器

<?xml version="1.0" encoding="utf-8"?>
<GridLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:rowCount="6"
  android:columnCount="4"
  android:layout_gravity="fill">
  <TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="0"
    android:textSize="80sp"
    android:layout_marginRight="5dp"
    android:layout_marginLeft="5dp"
    android:layout_columnSpan="4"
    android:background="#eee"
    android:padding="3sp"
    android:editable="false"
    android:textColor="#000"
    />
 <Button
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_columnSpan="4"
   android:text="清除"
   android:textColor="#000"
   android:textSize="24dp"
   android:layout_marginLeft="5dp"
   android:layout_marginRight="5dp"
   android:background="@android:color/background_light"
   />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="7"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="8"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="9"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="+"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="4"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="5"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="6"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="-"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="1"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="2"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="3"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="*"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="."
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="5dp"
    android:layout_marginRight="5dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="0"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="="
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
  <Button
    android:layout_marginTop="20dp"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="/"
    android:textColor="#000"
    android:textSize="24dp"
    android:layout_marginLeft="10dp"
    android:background="@android:color/background_light"
    />
</GridLayout>

以上內(nèi)容是小編給大家介紹的Android布局之GridLayout網(wǎng)格布局相關(guān)知識,希望大家喜歡。

相關(guān)文章

  • 詳解Android的四大應用程序組件

    詳解Android的四大應用程序組件

    這篇文章主要介紹了Android的應用程序組件的相關(guān)資料,幫助大家更好的理解和使用Android,感興趣的朋友可以了解下
    2021-01-01
  • Android下載gradle失敗的解決方法

    Android下載gradle失敗的解決方法

    這篇文章主要介紹了Android下載gradle失敗的解決方法,文章通過圖文結(jié)合的方式給大家介紹的非常詳細,對大家的學習或工作有一定的幫助,需要的朋友可以參考下
    2024-06-06
  • Android自定義View實現(xiàn)標簽流效果

    Android自定義View實現(xiàn)標簽流效果

    這篇文章主要為大家詳細介紹了Android自定義View實現(xiàn)標簽流效果,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • Android仿音樂播放器帶進度的播放暫停按鈕

    Android仿音樂播放器帶進度的播放暫停按鈕

    這篇文章主要為大家詳細介紹了Android仿音樂播放器帶進度的播放暫停按鈕,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2018-12-12
  • Android開發(fā)中滑動分頁功能實例詳解

    Android開發(fā)中滑動分頁功能實例詳解

    這篇文章主要介紹了Android開發(fā)中滑動分頁功能,結(jié)合實例形式詳細分析了Android滑動分頁功能的具體步驟與相關(guān)實現(xiàn)技巧,代碼中備有詳盡的注釋便于理解,需要的朋友可以參考下
    2017-10-10
  • Android實現(xiàn)微信朋友圈發(fā)本地視頻功能

    Android實現(xiàn)微信朋友圈發(fā)本地視頻功能

    這篇文章主要介紹了Android實現(xiàn)微信朋友圈發(fā)本地視頻功能的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2016-11-11
  • Android組件化、插件化詳細講解

    Android組件化、插件化詳細講解

    這篇文章主要介紹了Android組件化、插件化詳細講解,這些單獨?次封裝的功能模塊apk,就稱作插件,文章圍繞主題展開詳細的內(nèi)容介紹,需要的朋友可以參考一下
    2022-07-07
  • Android自定義View實現(xiàn)天氣預報折線圖

    Android自定義View實現(xiàn)天氣預報折線圖

    這篇文章主要為大家詳細介紹了Android自定義View實現(xiàn)天氣預報折線圖,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2022-09-09
  • Android實現(xiàn)離線緩存的方法

    Android實現(xiàn)離線緩存的方法

    離線緩存就是在網(wǎng)絡(luò)暢通的情況下將從服務(wù)器收到的數(shù)據(jù)保存到本地,當網(wǎng)絡(luò)斷開之后直接讀取本地文件中的數(shù)據(jù)。本文給大家介紹Android實現(xiàn)離線緩存的方法,需要的朋友參考下
    2016-03-03
  • Android 基于Socket的聊天應用實例(二)

    Android 基于Socket的聊天應用實例(二)

    本篇文章主要介紹了Android 基于Socket的聊天應用實例,具有一定的參考價值,有需要的可以了解一下。
    2016-12-12

最新評論

汉沽区| 惠东县| 濉溪县| 樟树市| 濉溪县| 临洮县| 东台市| 拜城县| 营口市| 开阳县| 大洼县| 福州市| 辛集市| 丹巴县| 华坪县| 安龙县| 梨树县| 山阳县| 三亚市| 三台县| 敦煌市| 平顶山市| 湟中县| 武强县| 辽阳市| 柯坪县| 弋阳县| 苏尼特左旗| 习水县| 沧州市| 衡南县| 繁昌县| 永昌县| 崇仁县| 眉山市| 汾阳市| 沾化县| 黑水县| 新泰市| 易门县| 惠安县|