Hello everyone I am trying to display 3 to X buttons on android. The idea is to always start with 3 buttons that takes each 33% of the size of the screen (width) And to be able to scroll Horizontaly through items.
Also theses items will be added programmatically to the view.
I tried to put a LinearLaout horizontal within an HorizontalScrollView. And then addchild to the linearlayout. but the items resize and it doesn't scroll.
Is it the right approach ? or does anyone have an idea how to make it ?
Class.java
HomeCircledButton button = HomeCircledButton_.build(this);
button.title.setText(sc.get(i).getLabel());
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 0.33f));
homeButtonsLL.addView(button);
Layout.xml
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal"
android:gravity="center"
android:weightSum="1.0"
android:id="@+id/home_buttons_ll">
</LinearLayout>
</HorizontalScrollView>
I also tried to create the buttons already in the XML and hide them programatically (View.GONE) but they just resize