仅是实现基本功能,页面粗糙请见谅
图片下标0开始
activity_main.xml页面:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
tools:context="com.example.gallery.MainActivity">
<Gallery
android:id="@+id/galPicture"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
</RelativeLayout>
GalleryAdapter.java页面:
package com.example.gallery;
import android.content.Context;
import android.view.View;
i

本文介绍了如何在Android中创建一个基本的Gallery组件。通过activity_main.xml布局文件、GalleryAdapter.java适配器类和MainActivity.java的Java代码,展示了如何加载并展示图片的基本步骤。虽然页面设计较为简单,但为初学者提供了基础的Gallery使用方法。
最低0.47元/天 解锁文章
1088

被折叠的 条评论
为什么被折叠?



