Android Java; 如何将assets文件夹中的本地JSON文件解析为ListView
我正在开发一个物理应用程序,应该显示一个公式列表,甚至解决其中一些(唯一的问题是ListView
)
这是我的主要布局
<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="wrap_content" android:measureWithLargestChild="false" android:orientation="vertical" tools:context=".CatList" > <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/titlebar" > <TextView android:id="@+id/Title1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/app_name" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#ff1c00" android:textIsSelectable="false" /> </RelativeLayout> <ListView android:id="@+id/listFormulas" android:layout_width="match_parent" android:layout_height="wrap_content" > </ListView></LinearLayout>
我实际上知道我可以在不使用JSON的情况下实现这一点,但我需要更多练习解析JSON。顺便说一句,这是JSON