Horizontal Scrollview In Fragment Android
I would like to make my ScrollView filling out the full layout of a fragment and scrolling horizontally, not vertically. How can I achieve that?! Like the album covers Thanks
Solution 1:
Its not vertically, it is horizontally
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"><HorizontalScrollViewandroid:layout_width="match_parent"android:layout_height="wrap_content"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"android:orientation="horizontal">
// Add your ImageButtons
</LinearLayout></HorizontalScrollView>
Solution 2:
You have to set the scrollview to
android:fillViewport="true"
Below is the complete code
<ScrollViewxmlns:android="http://schemas.android.com/apk/res/android"xmlns:tools="http://schemas.android.com/tools"android:id="@+id/myscrollView"android:layout_width="match_parent"android:layout_height="match_parent"android:fillViewport="true"></ScrollView>
Post a Comment for "Horizontal Scrollview In Fragment Android"