Android UI设计模式实例代码

移动开发 Android
Android UI设计模式实例代码是本文要介绍的内容,主要是来了解并学习Android UI设计,具体关于Android UI设计内容的详解来看本文。

Android UI设计模式实例代码是本文要介绍的内容,主要是来了解并学习Android UI设计,具体关于Android UI设计内容的详解来看本文。文章Android UI设计内容的实现主要是以代码来详解,内容不多。

  1. home.xml  
  2.  
  3. <?xml version="1.0" encoding="utf-8"?> 
  4. <merge 
  5.     xmlns:android="http://schemas.android.com/apk/res/android"> 
  6.     <include 
  7.         layout="@layout/background" /> 
  8.     <LinearLayout 
  9.         android:orientation="vertical" 
  10.         android:layout_width="fill_parent" 
  11.         android:layout_height="fill_parent"> 
  12.         <include 
  13.             layout="@layout/navigator" /> 
  14.         <include 
  15.             layout="@layout/list" 
  16.             android:layout_width="fill_parent" 
  17.             android:layout_height="fill_parent" 
  18.             android:layout_weight="1.0" /> 
  19.         <include 
  20.             layout="@layout/tab" /> 
  21.     </LinearLayout> 
  22. </merge> 
  1. background.xml  
  2.  
  3. <?xml version="1.0" encoding="utf-8"?> 
  4. <ImageView 
  5. xmlns:android="http://schemas.android.com/apk/res/android" 
  6.     android:id="@+id/background" 
  7.     android:layout_width="fill_parent" 
  8.     android:layout_height="fill_parent" 
  9.     android:scaleType="fitXY" 
  10.     android:background="@color/background" /> 
  1. navigator.xml  
  2.  
  3. <?xml version="1.0" encoding="utf-8"?> 
  4. <RelativeLayout 
  5.         android:layout_width="fill_parent" 
  6.         android:layout_height="64dp" 
  7.         android:gravity="center_vertical" 
  8.         style="@android:style/ButtonBar"> 
  9.         <Button 
  10.             android:id="@+id/button_back" 
  11.             android:layout_width="wrap_content" 
  12.             android:layout_height="40dp" 
  13.             android:text="@string/back" /> 
  14.         <Button 
  15.             android:id="@+id/button_home" 
  16.             android:layout_width="wrap_content" 
  17.             android:layout_height="40dp" 
  18.             android:layout_alignParentRight="true" /> 
  19.         <TextView 
  20.             android:id="@android:id/title" 
  21.             android:layout_width="fill_parent" 
  22.             android:layout_height="wrap_content" 
  23.             android:layout_toRightOf="@id/button_back" 
  24.             android:layout_toLeftOf="@id/button_home" 
  25.             android:gravity="center" 
  26.             android:singleLine="true" 
  27.             android:ellipsize="marquee" 
  28.             android:textAppearance="?android:attr/textAppearanceMedium" /> 
  29.     </RelativeLayout> 
  1. list.xml  
  2.  
  3. <?xml version="1.0" encoding="utf-8"?> 
  4. <ListView 
  5.     xmlns:android="http://schemas.android.com/apk/res/android" 
  6.     android:id="@android:id/list" 
  7.     android:layout_width="fill_parent" 
  8.     android:layout_height="fill_parent" 
  9.     android:cacheColorHint="@android:color/transparent" 
  10.     android:drawSelectorOnTop="false" 
  11.     android:listSelector="@drawable/list_selector_background" 
  12.     android:divider="@color/stroke" 
  13.     android:dividerHeight="@dimen/line_width" />  
  1. tab.xml  
  2.  
  3. <?xml version="1.0" encoding="utf-8"?> 
  4. <LinearLayout 
  5.     xmlns:android="http://schemas.android.com/apk/res/android" 
  6.     android:layout_width="fill_parent" 
  7.     android:layout_height="?android:attr/listPreferredItemHeight"> 
  8.     <ImageButton 
  9.         android:id="@+id/tab_profile" 
  10.         android:layout_width="wrap_content" 
  11.         android:layout_height="wrap_content" 
  12.         android:src="@drawable/tab_profile" 
  13.         android:layout_weight="1.0" 
  14.         android:background="@drawable/bg_btn" /> 
  15.     <ImageButton 
  16.         android:id="@+id/tab_friends" 
  17.         android:layout_width="wrap_content" 
  18.         android:layout_height="wrap_content" 
  19.         android:layout_weight="1.0" 
  20.         android:src="@drawable/tab_friends" 
  21.         android:background="@drawable/bg_btn" /> 
  22.     <ImageButton 
  23.         android:id="@+id/tab_games" 
  24.         android:layout_width="wrap_content" 
  25.         android:layout_height="wrap_content" 
  26.         android:layout_weight="1.0" 
  27.         android:src="@drawable/tab_games" 
  28.         android:background="@drawable/bg_btn" /> 
  29. </LinearLayout> 

小结:Android UI设计模式实例代码的内容介绍完了,希望通过Android UI设计内容的学习能对你有所帮助。

责任编辑:zhaolei 来源: 博客园
相关推荐

2011-06-01 16:12:11

Android UI

2011-05-28 15:14:06

设计技巧UIAndroid

2012-03-01 20:14:25

Android UI

2010-02-05 14:54:56

Android UI

2011-05-28 12:19:33

设计技巧UIAndroid

2013-11-26 16:09:34

Android设计模式

2010-01-21 09:08:53

.NET设计模式

2013-11-26 15:48:53

Android设计模式SDK

2011-09-07 14:01:41

Android Wid实例

2010-02-04 13:30:49

Android UI元

2016-03-28 10:23:11

Android设计单例

2013-11-26 16:20:26

Android设计模式

2020-11-13 18:59:51

UIAndroidJetBrains

2013-11-26 17:00:08

Android设计模式

2013-11-26 17:15:13

Android设计模式

2011-05-28 14:25:57

设计技巧UIAndroid

2011-09-13 16:39:50

Android UI设

2017-02-17 10:07:02

AndroidMVP模式实例

2013-11-26 17:09:57

Android设计模式

2013-11-26 16:29:22

Android设计模式
点赞
收藏

51CTO技术栈公众号