Программная клавиатура Android не прокручивается и закрывает EditText, когда установлен флаг окна «LayoutNoLimits» - PullRequest
0 голосов
/ 02 апреля 2019

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

Window.AddFlags(WindowManagerFlags.LayoutNoLimits);

Однако установка WindowManagerFlags.LayoutNoLimits не позволяет экранной клавиатуре прокручивать экран вверх, а редактируемые виды EditText скрываются вклавиатура.

1 Ответ

0 голосов
/ 02 апреля 2019

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

<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"
android:fitsSystemWindows="true"
android:background="@drawable/gradient">    
<ScrollView  
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:fillViewport="true"
         android:background="#fff">
   <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_centerInParent="true">
    <LinearLayout
        android:fitsSystemWindows="true"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_gravity="center"
        android:layout_marginBottom="10dp">
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="?android:attr/selectableItemBackground"
            android:src="@drawable/check">
            </ImageButton>
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="20dp"
            android:layout_marginRight="20dp"
            android:background="?android:attr/selectableItemBackground"
            android:src="@drawable/uncheck">
            </ImageButton>
        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="?android:attr/selectableItemBackground"
            android:src="@drawable/icaon">
            </ImageButton>
        </LinearLayout>

    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text = "11111111"/>
    <EditText
            android:id="@+id/edittext"
            android:layout_width="match_parent"
            android:imeOptions="actionGo"
            android:inputType="text"
            android:layout_height="wrap_content" />
  </LinearLayout>
</ScrollView>

Градиент:

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient android:angle="135" android:startColor="#f56f2c" android:endColor="#fa9f46"/>
</shape>

protected override void OnCreate(Bundle savedInstanceState)
    {        
        if (Build.VERSION.SdkInt >= Build.VERSION_CODES.Kitkat)
        {
            Window w = Window;

            w.AddFlags(WindowManagerFlags.TranslucentStatus);
            w.SetSoftInputMode(SoftInput.StateHidden | SoftInput.AdjustPan);
        }
        // Set our view from the "main" layout resource
        base.OnCreate(savedInstanceState);
        SetContentView(Resource.Layout.layout2);

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