android - How is the activity "adjustResize" attribute actually works -
these days learning when softkeyboard pop came, out how activity layout changed. wrote sample, , found strange.
here layout:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.margi.inputbar.mainactivity"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="hello world!" /> <linearlayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" android:orientation="vertical"> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="1" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="2" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="3" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="4" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="5" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="6" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="7" /> <textview android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margintop="30dp" android:text="8" /> </linearlayout> <include layout="@layout/layout_input" />
this manifest:
<application android:allowbackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsrtl="true" android:theme="@style/apptheme"> <activity android:name=".mainactivity" android:windowsoftinputmode="adjustresize"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> </application>
and use android studio ddms tool check layout state.
when hide softkeyboard layout is:
and xml layout is:
the linear layout has 8 child textviews.
and softkeyboard pop out:
the xml layout is:
the linearlayout has 4 child textviews
so, here 2 questions want find answers for:
(1) want know happened when softkeyboard shown, disappeared textview?
(2) there document, file or blog explain this? had read google's document google training, i'm still not clear this.
Comments
Post a Comment