0

Всем добрый день, есть разметка следующей структуры

> -- CoordinatorLayout
> ----AppBarLayout
> ------SearchView
> ----NestedScrollView
> ------ListView

Скриншоты из студии, для большей наглядности

Структура_1

Структура_2

После клика на иконку поиска в SearchView вводимый текст не отображается, предполагаю, что возможно что то наезжает сверху, если из структуры убираю ListView, тогда работает, но мне необходимо добавлять строки в список по результатам поиска, также исчезает кнопка очистки строки поиска. Ниже прикрепил гифку на которой всё отчетливо видно.

LogCat при этом не выдаёт ошибок.

Гифка - Ошибка в SearchView

Листинг всей разметки

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.design.widget.CoordinatorLayout 
    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:fitsSystemWindows="true"
    tools:context=".SearchActivity">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/app_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/app_bar_height"
        android:fitsSystemWindows="true"
        android:theme="@style/AppTheme.AppBarOverlay">

        <SearchView
            android:id="@+id/search_view"
            android:layout_width="match_parent"
            android:layout_height="@dimen/search_activity_height"
            android:fitsSystemWindows="true"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|exitUntilCollapsed"
            android:gravity="top" />

    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/search_content_scrolling" />

    ?xml version="1.0" encoding="utf-8"?>
    <android.support.v4.widget.NestedScrollView 
    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"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".SearchActivity"
    android:background="@color/colorPrimaryDark"
    tools:showIn="@layout/search_top">

    <ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />
    </android.support.v4.widget.NestedScrollView>

1 ответ 1

1

Оказалось, что экранная клавиатура сдвигает верстку, решение такое, добавить к listView следующие атрибуты

android:focusableInTouchMode="false"
android:isScrollContainer="false"

Ваш ответ

Нажимая на кнопку «Отправить ответ», вы соглашаетесь с нашими условиями использования и подтверждаете, что прочитали и поняли наши политику конфиденциальности и нормы поведения.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.