0
RecyclerView
アダプタを割り当ててアイテム装飾を追加することもできますが、アダプタはビューを作成しません。私はアイテムの装飾を削除したときにその建物の罰金。私がRecyclerViewを作成したxmlのコードを問題なく使用したので、アイテムの装飾に問題はありません。アダプタは、アイテム装飾を追加した後、プログラムで作成されたリサイクラビューでビューを作成しません
サンプルコードは以下の通りです:
RecyclerView recyclerView = new RecyclerView(context);
LinearLayout.LayoutParams recyclerViewLayoutParams =
new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT);
recyclerViewLayoutParams.gravity = Gravity.START;
recyclerView.setLayoutParams(recyclerViewLayoutParams);
recyclerView.setClipToPadding(false);
ll_parent_layout.addView(recyclerView);
LinearLayoutManager layoutManager = new LinearLayoutManager(getParent());
recyclerView.setLayoutManager(layoutManager);
recyclerView.setNestedScrollingEnabled(false);
recyclerView.setHasFixedSize(false);
// recyclerView.removeItemDecoration(gridSpacingItemDecoration);
// recyclerView.addItemDecoration(gridSpacingItemDecoration);
Adapter adapter = new Adapter(Activity.this, ResponseMap);
// linearSpacingItemDecoration = new LinearSpacingItemDecoration(R.dimen.margin8, adapter.getItemCount());
// recyclerView.removeItemDecoration(linearSpacingItemDecoration);
// recyclerView.addItemDecoration(linearSpacingItemDecoration);
recyclerView.setAdapter(adapter);
がrecyclerView.setAdapter方法でいくつかの時間後で考え出していましたか? – Drim
あなたのアイテムの装飾は何ですか?あなたは、アイテムの装飾は、リストアイテムのコンテンツビュー – Bhargav
を超えて**描画することを覚えておく必要があります@Drimそれはコード内にあります。私は貼り付けるのを忘れてしまった。 –