Horizontal Scroll View

 MainActivity -


  

package com.example.horizontalscrollview;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;


public class MainActivity extends AppCompatActivity {


    @Override

    protected void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);

        setContentView(R.layout.activity_main);

    }

}


-----------------------------------------------------------------------------------------------------


activity_main -


<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"

    xmlns:app="http://schemas.android.com/apk/res-auto"

    xmlns:tools="http://schemas.android.com/tools"

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical"

    tools:context=".MainActivity">



    <HorizontalScrollView

        android:layout_width="match_parent"

        android:layout_height="wrap_content">

        <LinearLayout

            android:layout_width="match_parent"

            android:layout_height="wrap_content"

            android:orientation="horizontal">



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button1"/>


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button2"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button3"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button4"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button5"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button6"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button7"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button8"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button9"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button10"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button11"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button12"/>


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button13"/>


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button14"/>


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button15"/>


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button16"/>


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button17"/>


            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Button18"/>



            <Button

                android:layout_width="wrap_content"

                android:layout_height="wrap_content"

                android:text="Buttonlast"/>


        </LinearLayout>



    </HorizontalScrollView>




</LinearLayout>


------------------------------------------------------------------------------------------------------------------------


AndroidManifest -


  

<?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

    package="com.example.horizontalscrollview">


    <application

        android:allowBackup="true"

        android:icon="@mipmap/ic_launcher"

        android:label="@string/app_name"

        android:roundIcon="@mipmap/ic_launcher_round"

        android:supportsRtl="true"

        android:theme="@style/AppTheme">

        <activity android:name=".MainActivity">

            <intent-filter>

                <action android:name="android.intent.action.MAIN" />


                <category android:name="android.intent.category.LAUNCHER" />

            </intent-filter>

        </activity>

    </application>


</manifest>

Comments

Popular posts from this blog

Generate Signing Release keystore

πŸš€ COMPLETE CI/CD FROM SCRATCH

Camera Application