前段时间研究了下android中九宫格布局的实现。纵观现在的应用程序,九宫格是非常常见的一种布局方式。很多优秀的手机应用程序都采用了这一布局。下面就android中九宫格布局方式的实现和大家做一个简单的介绍。
首先是main.xml的布局方式如下:
- <?xml version="1.0" encoding="utf-8"?>
- <!--主界面的布局-->
- <RelativeLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <RelativeLayout
- android:id="@+id/MainActivityrlTwo"
- android:layout_width="fill_parent"
- android:layout_height="45dp"
- >
- </RelativeLayout>
- <GridView
- android:id="@+id/MainActivityGrid"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:numColumns="3"
- android:columnWidth=