1
我已经在我的xml文件中构建了一个GridView,现在我想将它填充到Fragment类中。 (该片段类使用布局)Android - 如何从XML中查看并在碎片中使用它?
userhome.xml
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/home_gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_below="@+id/user_avatar"
android:paddingTop="16dp"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="columnWidth"
android:gravity="center" />
public class UserHomeFragment extends Fragment {
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return inflater.inflate(R.layout.userhome, container, false);
}
我真的不知道怎么把我的 “home_gridview”,我什么都试过,但没有工作! 我需要这个,因为我想在我的一个操作栏的选项卡中使用它。你能帮我一些代码吗? 谢谢你们!
谢谢您的帮助! – hyperloris 2012-07-15 17:52:44