zoukankan      html  css  js  c++  java
  • Android笔记之输入法挡住控件解决

    1、在AndroidManifest.xml的Activity设置属性:android:windowSoftInputMode = "adjustResize" ,软键盘弹出时,要对主窗口布局重新进行布局,并调用onSizeChanged方法,切记一点当我们设置为“adjustResize”时,我们的界面 不要设置为全屏模式,否则设置了这个属性也不会有什么效果。

    当我们设置 android: windowSoftInputMode = "adjustPan",主窗口就不会调用onSizeChanged方法,界面的一部分就会被软键盘覆盖住,就不会被挤到软键盘之上了

    2,将布局改成ScrollView

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView    xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" 
             >
    <LinearLayout 
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >
        
        <com.example.edit.MyEditText
            android:id="@+id/tv_state"
            android:layout_width="match_parent"
            android:layout_height="278dp"
            android:background="#cccccc"
            android:focusable="true"
            android:gravity="top"
            android:hint="@string/note"
            android:textSize="25dp" />
           <Button
            android:id="@+id/button1"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="测试4" />
    </LinearLayout>
    </ScrollView>
  • 相关阅读:
    169. Majority Element
    283. Move Zeroes
    1331. Rank Transform of an Array
    566. Reshape the Matrix
    985. Sum of Even Numbers After Queries
    1185. Day of the Week
    867. Transpose Matrix
    1217. Play with Chips
    766. Toeplitz Matrix
    1413. Minimum Value to Get Positive Step by Step Sum
  • 原文地址:https://www.cnblogs.com/xingyyy/p/3278042.html
Copyright © 2011-2022 走看看