易网时代-编程资源站
Welcome
微信登录
编程资源
图片资源库
蚂蚁家优选
PDF转换器
软件资源
软件开发
、
小程序制作
、
系统集成与运维
、
空间租用
、
硬件开发
、
视频监控
、
技术咨询与支持
——联系电话:0311-88999002/88999003
首页
/
操作系统
/
Linux
/
关于Android GridView的用法
一、布局文件1、布局文件GridView
<?xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<LinearLayout
xmlns:Android
=
"http://schemas.android.com/apk/res/android"
android:orientation
=
"vertical"
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
android:weightSum
=
"1"
>
<TextView
android:layout_width
=
"fill_parent"
android:layout_height
=
"wrap_content"
android:text
=
"@string/hello"
/>
<GridView
android:id
=
"@+id/gridView1"
android:layout_height
=
"wrap_content"
android:background
=
"#000000"
android:numColumns
=
"4"
android:layout_width
=
"wrap_content"
>
</GridView>
</LinearLayout>
2、grid_item.xml布局文件
<?xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:orientation
=
"vertical"
android:layout_width
=
"match_parent"
android:layout_height
=
"match_parent"
>
<ImageView
android:layout_height
=
"wrap_content"
android:id
=
"@+id/item_imageView"
android:layout_width
=
"wrap_content"
android:src
=
"@drawable/icon"
android:layout_gravity
=
"center"
></ImageView>
<TextView
android:text
=
"TextView"
android:id
=
"@+id/item_textView"
android:layout_width
=
"wrap_content"
android:textColor
=
"#ffffff"
android:layout_height
=
"wrap_content"
android:layout_gravity
=
"center"
></TextView>
</LinearLayout>
收藏该网址
版权所有©石家庄振强科技有限公司2024
冀ICP备08103738号-5
网站地图