Android HorizontalScrollView - PullRequest
       16

Android HorizontalScrollView

0 голосов
/ 12 марта 2019

Я делаю фрагмент с горизонтальной прокруткой на предыдущем экране. HorizontalScrollView находится во фрагменте он работал нормально, когда это было действие, но когда вы меняете его на фрагмент, интерфейс застревает

У меня есть HorizontalScrollView внутри моего ViewPager. но при помещении его во фрагмент интерфейс не работает должным образом, но в момент перемещения вида вправо или влево он остается как изображение

Как показано на рисунке ниже.

View Example

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/FragmentoLayout_fonemasTar"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <HorizontalScrollView
        android:id="@+id/horizontalScrollView1Tar"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/secondary_text_light"
        android:fadeScrollbars="false"
        android:scrollbarSize="2dp"
        android:scrollbarThumbHorizontal="@drawable/border_scroll_listview">

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

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

                <LinearLayout
                    android:layout_width="150dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarCampo1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarCampo1" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="80dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarCampo2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarCampo2" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="150dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarCampo3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarCampo3" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="30dp"
                    android:layout_height="wrap_content">

                    <TextView
                        android:id="@+id/lblEspacio1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_FormatoTar_txtTarSubCampo3" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="150dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarSubCampo3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarSubCampo345" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="150dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarCampo4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarCampo4" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="30dp"
                    android:layout_height="wrap_content">

                    <TextView
                        android:id="@+id/lblEspacio2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_FormatoTar_txtTarSubCampo4" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="150dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarSubCampo4"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarSubCampo345" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="150dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarCampo5"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarCampo5" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="30dp"
                    android:layout_height="wrap_content">

                    <TextView
                        android:id="@+id/lblEspacio3"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_FormatoTar_txtTarSubCampo5" />

                </LinearLayout>

                <LinearLayout
                    android:layout_width="150dp"
                    android:layout_height="match_parent"
                    android:gravity="center">

                    <TextView
                        android:id="@+id/lblTarSubCampo5"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/LayoutTar_lblTarSubCampo345" />

                </LinearLayout>

            </LinearLayout>

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

                <ListView
                    android:id="@+id/lst_PuntoArtFon1"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:fadeScrollbars="false"
                    android:scrollbarThumbVertical="@drawable/border_scroll_listview"
                    tools:listitem="@layout/formato_tar_layout"></ListView>

            </LinearLayout>

        </LinearLayout>

    </HorizontalScrollView>

</LinearLayout>

Ответы [ 3 ]

1 голос
/ 12 марта 2019

сделать фоновый цвет: белым, и clickable = true.Это решит вашу проблему

0 голосов
/ 12 марта 2019

Сделайте цвет фона белым и щелкните событие как истинное.Это может решить вашу проблему

0 голосов
/ 12 марта 2019

Это происходит потому, что новый загружаемый вид (смахиванием вправо / влево) находится над HorizontalScrollView, а его фоновый цвет прозрачен. Вы должны задать белый фоновый цвет для родительского LinearLayout всех фрагментов.

Также установите для android: clickable значение true, чтобы события касания не запускали предыдущие фрагменты.

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