新闻专栏功能模块

新闻专栏功能模块,第1张

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());
                }
            });

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/892454.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-14
下一篇 2022-05-14

发表评论

登录后才能评论

评论列表(0条)

保存