我试图建立一个画廊.我知道如何获取所有照片并在网格视图中显示它们.但有人可以解释如何获取和显示文件夹(带照片)?
我启动apk文件后出错了.看看我的xml文件,这可能是错的??? gridview.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<GridView
android:id="@+id/gridView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginBottom="-10dp"
android:layout_marginLeft="-10dp"
android:layout_marginRight="-10dp"
android:layout_marginTop="-10dp"
android:horizontalSpacing="-15dp"
android:numColumns="3"
android:padding="0dp"
android:verticalSpacing="-15dp" >
</GridView>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
和grid_item:
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:gravity="center"
android:scaleType="center"
/>
Run Code Online (Sandbox Code Playgroud)