Я пытаюсь перечислить RecyclerView в деятельности, но это невозможноКак я могу добавить много RecyclerView в активность?
Это MainActivity
private RecyclerView mRecyclerView;
private RecyclerView.Adapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
LinearLayout layoutMain = new LinearLayout(this);
layoutMain.setOrientation(LinearLayout.VERTICAL);
setContentView(layoutMain);
LayoutInflater inflate = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
RecyclerView recList = new RecyclerView(this);
recList.setHasFixedSize(true);
LinearLayoutManager llm = new LinearLayoutManager(this);
llm.setOrientation(LinearLayoutManager.VERTICAL);
recList.setLayoutManager(llm);
custom_button buttons = new custom_button(this, "button");
Button buttons2 = new Button(this);
buttons2.setText("button2");
ContactAdapter ca = new ContactAdapter(createList(3));
recList.setAdapter(ca);
layoutMain.addView(buttons); // this is custom button
layoutMain.addView(recList); // this is RecyclerView but it
layoutMain.addView(buttons2);
}
это image, когда она полная
И когда я добавить много View в деятельности он может» т пролистайте: '(
кто-нибудь поможет мне решить эту проблему
G ive меня какое-то ключевое слово или любой TUT, так много спасибо. , ,
р/с: я просто хочу сделать макет, как Google Store признакам список, как этот IMAGE
Используйте относительную компоновку. Добавить кнопку с параметром как alignParent top button 2 как alignParent bottom и recycler view с параметрами макета выше кнопки 2 и ниже. Это даст вам желаемый макет. Рассмотрим давать осмысленные имена кнопок, а также пройти через ява именовании –
'ALIGN_PARENT_TOP CENTER_IN_PARENT ALIGN_PARENT_BOTTOM ' (custom_button?): '(Не работает вы можете мне помочь исправить эту глупую код –