Unable to set dynamic layout in your ExpandableLayout on runtime.
jitblue opened this issue · comments
jitblue commented
I am unable to set dynamic layout in your ExpandableLayout. Please send some thing so that I can implement it.
LinearLayout lllistcontener = (LinearLayout) view.findViewById(R.id.lllistcontener);
lllistcontener.removeAllViews();
LinearLayout parent = new LinearLayout(view.getContext());
parent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
parent.setOrientation(LinearLayout.HORIZONTAL);
//children of parent linearlayout
ImageView iv = new ImageView(view.getContext());
iv.setBackgroundResource(R.drawable.prson);
LinearLayout layout2 = new LinearLayout(view.getContext());
layout2.setBackgroundColor(Color.parseColor("#d3d3d3"));
layout2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT));
parent.setOrientation(LinearLayout.VERTICAL);
parent.addView(iv);
parent.addView(layout2);
//children of layout2 LinearLayout
TextView tv1 = new TextView(view.getContext());
tv1.setText("Sadadasdasd");
TextView tv2 = new TextView(view.getContext());
tv2.setText("Sadadasdasd");
TextView tv3 = new TextView(view.getContext());
tv3.setText("Sadadasdasd");
TextView tv4 = new TextView(view.getContext());
tv4.setText("Sadadasdasd");
layout2.addView(tv1);
layout2.addView(tv2);
layout2.addView(tv3);
layout2.addView(tv4);
lllistcontener.removeAllViews();
lllistcontener.addView(layout2);
/* ViewGroup.LayoutParams params = subcommentlist.getLayoutParams();
params.height = 800;
subcommentlist.setLayoutParams(params);
subcommentlist.requestLayout();*/
expandableLayout.setCollapseHeight(300);
expandableLayout.expand();
expandMap.put(position, true);
Erygor commented
I am unable to set dynamic layout in your ExpandableLayout. Please send some thing so that I can implement it.
LinearLayout lllistcontener = (LinearLayout) view.findViewById(R.id.lllistcontener); lllistcontener.removeAllViews(); LinearLayout parent = new LinearLayout(view.getContext()); parent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); parent.setOrientation(LinearLayout.HORIZONTAL); //children of parent linearlayout ImageView iv = new ImageView(view.getContext()); iv.setBackgroundResource(R.drawable.prson); LinearLayout layout2 = new LinearLayout(view.getContext()); layout2.setBackgroundColor(Color.parseColor("#d3d3d3")); layout2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); parent.setOrientation(LinearLayout.VERTICAL); parent.addView(iv); parent.addView(layout2); //children of layout2 LinearLayout TextView tv1 = new TextView(view.getContext()); tv1.setText("Sadadasdasd"); TextView tv2 = new TextView(view.getContext()); tv2.setText("Sadadasdasd"); TextView tv3 = new TextView(view.getContext()); tv3.setText("Sadadasdasd"); TextView tv4 = new TextView(view.getContext()); tv4.setText("Sadadasdasd"); layout2.addView(tv1); layout2.addView(tv2); layout2.addView(tv3); layout2.addView(tv4); lllistcontener.removeAllViews(); lllistcontener.addView(layout2); /* ViewGroup.LayoutParams params = subcommentlist.getLayoutParams(); params.height = 800; subcommentlist.setLayoutParams(params); subcommentlist.requestLayout();*/ expandableLayout.setCollapseHeight(300); expandableLayout.expand(); expandMap.put(position, true);
I am unable to set dynamic layout in your ExpandableLayout. Please send some thing so that I can implement it.
LinearLayout lllistcontener = (LinearLayout) view.findViewById(R.id.lllistcontener); lllistcontener.removeAllViews(); LinearLayout parent = new LinearLayout(view.getContext()); parent.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); parent.setOrientation(LinearLayout.HORIZONTAL); //children of parent linearlayout ImageView iv = new ImageView(view.getContext()); iv.setBackgroundResource(R.drawable.prson); LinearLayout layout2 = new LinearLayout(view.getContext()); layout2.setBackgroundColor(Color.parseColor("#d3d3d3")); layout2.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT)); parent.setOrientation(LinearLayout.VERTICAL); parent.addView(iv); parent.addView(layout2); //children of layout2 LinearLayout TextView tv1 = new TextView(view.getContext()); tv1.setText("Sadadasdasd"); TextView tv2 = new TextView(view.getContext()); tv2.setText("Sadadasdasd"); TextView tv3 = new TextView(view.getContext()); tv3.setText("Sadadasdasd"); TextView tv4 = new TextView(view.getContext()); tv4.setText("Sadadasdasd"); layout2.addView(tv1); layout2.addView(tv2); layout2.addView(tv3); layout2.addView(tv4); lllistcontener.removeAllViews(); lllistcontener.addView(layout2); /* ViewGroup.LayoutParams params = subcommentlist.getLayoutParams(); params.height = 800; subcommentlist.setLayoutParams(params); subcommentlist.requestLayout();*/ expandableLayout.setCollapseHeight(300); expandableLayout.expand(); expandMap.put(position, true);