中文字幕第五页-中文字幕第页-中文字幕韩国-中文字幕最新-国产尤物二区三区在线观看-国产尤物福利视频一区二区

詳解Android布局優化-創新互聯

怎樣才能寫出優秀的Android App,是每一個程序員追求的目標。那么怎么才能寫出一個優秀的App呢?相信很多初學者也會有這種迷茫。一句話來回答這個問題:細節很重要。今天我們就從最基礎的XML布局來談談怎么提高Android性能問題吧!

成都創新互聯是一家集網站建設,集賢企業網站建設,集賢品牌網站建設,網站定制,集賢網站建設報價,網絡營銷,網絡優化,集賢網站推廣為一體的創新建站企業,幫助傳統企業提升企業形象加強企業競爭力。可充分滿足這一群體相比中小企業更為豐富、高端、多元的互聯網需求。同時我們時刻保持專業、時尚、前沿,時刻以成就客戶成長自我,堅持不斷學習、思考、沉淀、凈化自己,讓我們為更多的企業打造出實用型網站。

也許你經常會遇到比較復雜的布局,這種情況下,最簡單的方法就是多層嵌套實現效果,但是最簡單的方法是否是最優的方法呢? 這里需要打一個大大的問號?????經驗告訴我們,往往簡單的方法,得到的結果不是最優解,那么我們通過一個例子來研究一下怎么去優化我們的XML布局吧,下面通過經典微信中的“發現”tab頁面中的布局來看看怎么實現。

詳解Android布局優化

上面這張圖片是微信界面截圖,看到這張效果圖的第一眼會讓開發者想到使用線性布局實現這種左邊圖片,右邊文字,一行白色背景效果很方便。那么我們就按照一般思路寫出如下布局代碼:

<LinearLayout 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="@color/color_eeeeee"
 android:orientation="vertical"
 tools:context=".MainActivity">

 <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="0dp"
  android:layout_weight="1"
  android:orientation="vertical">


  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="20dp"
   android:background="@drawable/item_bg_select"
   android:clickable="true"
   android:gravity="center_vertical"
   android:orientation="horizontal"
   android:paddingLeft="20dp"
   android:paddingRight="20dp">

   <ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/afe" />

   <TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginLeft="15dp"
    android:text="@string/fiends"
    android:textColor="@android:color/black"
    android:textSize="16sp" />
  </LinearLayout>


  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="20dp"
   android:background="@android:color/white"
   android:orientation="vertical">

   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/item_bg_select"
    android:clickable="true"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingLeft="20dp"
    android:paddingRight="20dp">

    <ImageView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:src="@drawable/afg" />

    <TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="15dp"
     android:text="@string/scan"
     android:textColor="@android:color/black"
     android:textSize="16sp" />
   </LinearLayout>

   <View
    android:layout_width="match_parent"
    android:layout_height="0.5dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:background="@color/color_e0e0e0"></View>

   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/item_bg_select"
    android:clickable="true"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingLeft="20dp"
    android:paddingRight="20dp">

    <ImageView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:src="@drawable/afh" />

    <TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="15dp"
     android:text="@string/shake"
     android:textColor="@android:color/black"
     android:textSize="16sp" />
   </LinearLayout>

  </LinearLayout>

  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="20dp"
   android:background="@android:color/white"
   android:orientation="vertical">


   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/item_bg_select"
    android:clickable="true"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingLeft="20dp"
    android:paddingRight="20dp">

    <ImageView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:src="@drawable/afd" />

    <TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="15dp"
     android:text="@string/nearby"
     android:textColor="@android:color/black"
     android:textSize="16sp" />
   </LinearLayout>

   <View
    android:layout_width="match_parent"
    android:layout_height="0.5dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:background="@color/color_e0e0e0"></View>

   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/item_bg_select"
    android:clickable="true"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingLeft="20dp"
    android:paddingRight="20dp">

    <ImageView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:src="@drawable/afb" />

    <TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="15dp"
     android:text="@string/float_bottle"
     android:textColor="@android:color/black"
     android:textSize="16sp" />
   </LinearLayout>

  </LinearLayout>


  <LinearLayout
   android:layout_width="match_parent"
   android:layout_height="wrap_content"
   android:layout_marginTop="20dp"
   android:background="@android:color/white"
   android:orientation="vertical">

   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/item_bg_select"
    android:clickable="true"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingLeft="20dp"
    android:paddingRight="20dp">

    <ImageView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:src="@drawable/agg" />

    <TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="15dp"
     android:text="@string/shopping"
     android:textColor="@android:color/black"
     android:textSize="16sp" />
   </LinearLayout>

   <View
    android:layout_width="match_parent"
    android:layout_height="0.5dp"
    android:layout_marginLeft="10dp"
    android:layout_marginRight="10dp"
    android:background="@color/color_e0e0e0"></View>

   <LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="@drawable/item_bg_select"
    android:clickable="true"
    android:gravity="center_vertical"
    android:orientation="horizontal"
    android:paddingLeft="20dp"
    android:paddingRight="20dp">

    <ImageView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:src="@drawable/ak6" />

    <TextView
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:layout_marginLeft="15dp"
     android:text="@string/games"
     android:textColor="@android:color/black"
     android:textSize="16sp" />
   </LinearLayout>

  </LinearLayout>
 </LinearLayout>

 <LinearLayout
  android:layout_width="match_parent"
  android:layout_height="wrap_content"
  android:background="@android:color/white"
  android:orientation="horizontal">

  <TextView
   android:layout_width="0dp"
   android:layout_height="wrap_content"
   android:layout_weight="1"
   android:drawableTop="@drawable/ala"
   android:gravity="center"
   android:text="@string/weixin"
   android:textColor="@color/color_9e9e9e" />

  <TextView
   android:layout_width="0dp"
   android:layout_height="wrap_content"
   android:layout_weight="1"
   android:drawableTop="@drawable/al9"
   android:gravity="center"
   android:text="@string/countans"
   android:textColor="@color/color_9e9e9e" />

  <TextView
   android:layout_width="0dp"
   android:layout_height="wrap_content"
   android:layout_weight="1"
   android:drawableTop="@drawable/alc"
   android:gravity="center"
   android:text="@string/finds"
   android:textColor="@color/color_9e9e9e" />

  <TextView
   android:layout_width="0dp"
   android:layout_height="wrap_content"
   android:layout_weight="1"
   android:drawableTop="@drawable/ale"
   android:gravity="center"
   android:text="@string/me"
   android:textColor="@color/color_9e9e9e" />

 </LinearLayout>


</LinearLayout>

網頁名稱:詳解Android布局優化-創新互聯
本文路徑:http://www.2m8n56k.cn/article44/cepdhe.html

成都網站建設公司_創新互聯,為您提供響應式網站網站維護網站收錄外貿網站建設定制網站ChatGPT

廣告

聲明:本網站發布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:[email protected]。內容未經允許不得轉載,或轉載時需注明來源: 創新互聯

成都網站建設公司
主站蜘蛛池模板: 成人欧美日韩视频一区 | 国产三级免费观看 | 加勒比色综合 | 日韩精品欧美国产精品亚 | 国产一区二区三区毛片 | 国产一级做a爰片在线看 | 在线播放一区二区三区 | 久久免费大片 | 亚洲不卡在线观看 | 亚洲视频中文字幕在线观看 | www亚洲免费 | 日韩精品亚洲人成在线观看 | 九九99靖品 | 国产精品天天爽夜夜欢张柏芝 | 久久久久久久久国产 | 日本不卡一区二区三区在线观看 | 国产精品天天爽夜夜欢张柏芝 | 国产成人在线小视频 | 日产国产精品久久久久久 | a级毛片免费完整视频 | 亚洲成在人线免费视频 | 免费在线观看a | 成人三级视频在线观看 | 真人毛片免费全部播放完整 | 国产精品久久久久久久久久久久久久 | 国产在线观看第一页 | 亚洲国产精品综合久久一线 | 日韩在线视屏 | 2020国产微拍精品一区二区 | 91国在线啪精品一区 | 国产成人精品999在线观看 | 中国a级毛片免费 | 国产成人无精品久久久 | 精品亚洲欧美高清不卡高清 | 成人怡红院视频在线观看 | 韩国自拍偷自拍亚洲精品 | 大陆老头xxxxxhd | 国内精品久久久久久久星辰影视 | 国产精品久久久久三级 | 伊人久久综合热青草 | 亚洲三级在线看 |