Возврат к началу в HorizontalScrollView в Kotlin на Android - PullRequest
0 голосов
/ 07 мая 2020

Я использую Kotlin с HorizontalScrollView, и я пытаюсь повернуть кнопки, так что если вы go до последней кнопки, отображается первая кнопка.

enter image description here

enter image description here

enter image description here Например, если вы go справа («BUTTON11 »), Он возвращается к началу (« КНОПКА1 »- которую я вставил, чтобы показать то, что я пытаюсь показать)?

Есть идеи, пожалуйста, как заставить их вращаться на 100%? Большое спасибо!

<androidx.constraintlayout.widget.ConstraintLayout 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"
tools:context=".MainActivity">


<HorizontalScrollView
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="200dp"
        android:orientation="horizontal">


        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#000"
            android:text="Button 1"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#e71313"
            android:text="Button 2"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#14e634"
            android:text="Button 3"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#dc12ea"
            android:text="Button 4"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#08e9b5"
            android:text="Button 5"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#000"
            android:text="Button 6"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#e2c90d"
            android:text="Button 7"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#bc10f1"
            android:text="Button 8"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#eda514"
            android:text="Button 9"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#13e8f7"
            android:text="Button 10"
            android:textColor="#fff"
            android:textStyle="bold" />

        <Button
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:background="#000"
            android:text="Button 11"
            android:textColor="#fff"
            android:textStyle="bold" />

    </LinearLayout>

</HorizontalScrollView>

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...