home_layout
item_]news_type
MainActivity.java
setNewslCategotyData();
// 新闻类型
private void setNewslCategotyData() {
RetrofitClient.apiService().getNewslCategotyDate().enqueue(new Callback() {
@Override
public void onResponse(Call call, Response response) {
NewslCategotyListBean body = response.body();
if (body!=null&&body.getCode()==200) {
List rows = body.getData();
List data = new ArrayList<>();
for (NewslCategotyListBean.DataBean i:rows){
data.add(i.getName());
}
ArrayAdapter adapter=new ArrayAdapter<>(getActivity().getApplicationContext(),R.layout.item_news_categroty,R.id.item_new_categroty,data);
gridView_type.setAdapter(adapter);
}
}
@Override
public void onFailure(Call call, Throwable throwable) {
}
});
}
// 新闻专栏的点击事件
gridView_type.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView> parent, View view, int position, long id) {
setNewsList(rows1.get(position).getId());
}
});
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)