2016-08-02 100 views
0

線性佈局內部有一個滾動視圖&按鈕(位於底部)。工具欄對於屏幕是固定的。當鍵盤打開時,按鈕向上移動。我希望按鈕不要向上移動。當鍵盤打開時底部按鈕向上移動

+0

可以添加你的屏幕截圖 –

+0

你可以分享你的xml文件 –

回答

0

如果您使用的片段寫在onCreateView下面的代碼:

getActivity().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE); 
0

使用下面的代碼來改變你的manifest.xml ,,對於那些XML佈局包含活動。

android:windowSoftInputMode="stateUnchanged|adjustResize" 

OR

android:windowSoftInputMode="adjustPan|adjustResize" 

更改清單文件

<application 
    android:allowBackup="true" 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name="com.example.adjustscroll.MainActivity" 
     android:label="@string/app_name" 
     android:windowSoftInputMode="stateUnchanged|adjustResize" 
     > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

希望這會幫助你。讓我知道如果解決。

0

在XML文件中,你可以使用滾動型:

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <!--your layout--> 

</ScrollView> 
0

確保您的活動具有以下屬性,在AndroidManifest.xml

android:windowSoftInputMode="adjustResize" 

而且在佈局XML文件LinearLayout作爲父爲ButtonEditText

0

此問題與該活動的清單屬性。

你是否在下面的清單中添加了任何屬性?

android:windowSoftInputMode="adjustPan" 

或者

android:windowSoftInputMode="adjustResize" 
相關問題