0
我正在开发一个应用程序,将显示女孩时尚类别。我试图在网格视图中显示类别。但是当我测试应用程序时,Grid View在我滚动它的时候正在崩溃。以下是我的代码。请帮助我。提前致谢。GridView断开滚动?
single_item.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="10dp"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:layout_width="150dp"
android:layout_height="150dp"
android:id="@+id/grid_image"/>
<TextView
android:maxLines="1"
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/grid_text"
android:textColor="#000"
android:textSize="20sp"
android:gravity="center"/>
</LinearLayout>
和
activity_browse.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context="com.example.user.beautyworld.BrowseActivity">
<GridView
android:id="@+id/grid_view"
android:layout_width="match_parent"
android:padding="10dp"
android:numColumns="auto_fit"
android:gravity="center"
android:columnWidth="150dp"
android:layout_height="match_parent">
</GridView>
</LinearLayout>
我仍然面临问题 –