【发布时间】:2015-08-19 14:32:35
【问题描述】:
我正在解析片段中的 Json 数据。为了查看这个 Json 数据,我使用了 RecycleView。在这个片段中,我展示了一些帖子的简短细节。我希望当用户单击 recycleView 时,它将转到另一个活动并显示此帖子的详细信息。如何让我的 RecycleView 可点击?
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_recent_post, container, false);
recentpostRecycleView = (RecyclerView) view.findViewById(R.id.recent_posts);
recentpostRecycleView.setLayoutManager(new LinearLayoutManager(getActivity()));
recentPostAdapter = new RecentPostAdapter(getActivity());
recentpostRecycleView.setAdapter(recentPostAdapter);
sendJsonRequest();
return view;
}
我的 RecycleView 截图:
【问题讨论】:
标签: android json android-fragments