我想我需要创建自定义布局,但我不知道该怎么做

时间:2019-01-19 12:28:33

标签: java android

我想设计这个 this is image

这是我点击API后得到的结果,您可以看到项目之间的差异,这就是为什么它看起来不酷的原因我在回收器视图中使用了网格布局,结果为3,这就是为什么单词长度增加其字词增加项目高度的原因 this is what i get

这是我的代码

public void apiCalling() {
 APIinterface apIinterface = 

APIClient.getClient().create(APIinterface.class);
retrofit2.Call<WatchListModel> call = apIinterface.getWatchListModel();

call.enqueue(new Callback<WatchListModel>() {
@Override
public void onResponse(retrofit2.Call<WatchListModel> call, 
Response<WatchListModel> response) {

ArrayList<Object> alldata = (ArrayList<Object>) 
response.body().getWishlist().get(0).getBlogTags();
Log.e("alldata", "onBindViewHolder: " + alldata);
for (int c = 0; c <= alldata.size() - 1; c++) {
String Blogtag = String.valueOf(alldata.get(c));
blogarray.add(Blogtag);
Log.e("blogtag", " " + blogarray);
}
List<Wishlist> wishlist = response.body().getWishlist();
detail.setText(wishlist.get(0).getBlogDescription());
Log.e("witchlist", "onResponse: " + wishlist);
watchlist_recycler.setLayoutManager(new GridLayoutManager(getActivity(), 
3));
watchListAdapter = new WatchListAdapter(lorem, wishlist, blogarray);
watchlist_recycler.setAdapter(watchListAdapter);
}

@Override
public void onFailure(retrofit2.Call<WatchListModel> call, Throwable t) {
Toast.makeText(getContext(), "Please Check your internet n=connection", 
Toast.LENGTH_SHORT).show();

}
});
}`

0 个答案:

没有答案