I am developing a feature where on click a button, new view/Button gets added from left to right, when it runs out of space it automatically adds the button to the next line. Just following up this link, after integrating I am unable to see the buttons in my view.
Any clue is appreciated.
Here is my code.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/layout_filter"
android:orientation="horizontal">
</LinearLayout>
<com.mypackage.predicatebuttonclass
android:id="@+id/predicate_layout"
android:layout_below="@id/layout_filter"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
Adding text view dynamically
predicateLayout myLayout;
myLayout;= (PredicateLayout)mFilterLayout.findViewById(R.id.predicate_layout);
for (int i = 0; i < 10; i++)
{
TextView t = new TextView(ProductListingFragment.this.getActivity());
t.setText("Hello");
t.setBackgroundColor(Color.RED);
t.setSingleLine(true);
myLayout.addView(t, new PredicateLayout.LayoutParams(2, 0));
}