0

朋友,RelativeLayout在ScrollView中不是Scrolable

任何想法爲什麼以下佈局不可滾動?我有一個RelativeLayoputScrollView。視圖適合在屏幕上。但是當彈出鍵盤時會覆蓋它們。我想使屏幕滾動時彈出鍵盤,因爲它包括了登錄名和密碼EditBoxes所以它是哈日,看看別人是打字

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"  
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" > 

     <com.alarm.alarmmobile.android.view.RobotoLightTextView 
      android:id="@+id/passcode_login_text" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginTop="20dp" 
      android:text="@string/passcode_login_body" 
      android:textAppearance="?android:attr/textAppearanceSmall" /> 

     <EditText 
      android:id="@+id/passcode_login_username" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/passcode_login_text" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginTop="20dp" 
      android:hint="@string/login_textview_username" 
      android:singleLine="true" /> 

     <EditText 
      android:id="@+id/passcode_login_password" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_below="@id/passcode_login_username" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:hint="@string/login_textview_password" 
      android:inputType="textPassword" 
      android:singleLine="true" /> 

     <com.alarm.alarmmobile.android.view.RobotoLightButton 
      android:id="@+id/passcode_login_button" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" 
      android:layout_below="@id/passcode_login_password" 
      android:layout_marginRight="16dp" 
      android:paddingLeft="20dp" 
      android:paddingRight="20dp" 
      android:text="@string/login_button_login" /> 

    </RelativeLayout> 

</ScrollView> 
+0

向我們展示它是如何看 –

+0

嘗試把'機器人:方向=「垂直」'在滾動型。 –

+0

android:orientation =「vertical」不能解決它。 –

回答

0

如果一切可以適合在屏幕上時,ScrollView不會能夠在任何地方滾動。如果有一個組件不完全可見,那麼滾動應該可用於查看組件的其餘部分。如果不能看出問題是什麼,就很難找到確切的解決方案。

+0

你是正確的屏幕上的兩個EditBoxes。彈出鍵盤時會覆蓋它們。那是我想滾動內容的時候。我怎麼做? –

+0

儘管所有東西都適合在屏幕上,但我該如何使它變得可以被人盜用? –

1

在您的清單包含此:

<activity android:name="..." // your activity here 
    .... 
    android:windowSoftInputMode="adjustResize|adjustPan"> 
/> 

注:不知道添加adjustPan會導致再次或不上來的問題。

+0

這是有效的,但是有沒有其他方法可以達到同樣的效果?我需要有android:windowSoftInputMode =「adjustPan」 –

1

在活動或片段類此佈局的,你必須把這個:

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

這是有效的,但是有沒有其他辦法可以達到同樣的效果?我需要有android:windowSoftInputMode =「adjustPan」 –

+0

'getWindow()。setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);' – luiscosta

相關問題