2016-08-08 6 views
0

EditTextButtonの2つのログインレイアウトがあります。 EditTextにテキストを入力しているときにキーボードが開いていると、それは私のlayoutの一部と重なります。スクロールアップしようとしましたが、レイアウトをスクロールして表示することはできません。私はそれを作成するために相対レイアウトを使用しています。どのようにそれを解決するには? ありがとうございます。Androidはスクロールできません

+0

あなたは何を求めていますか?スナップショットを共有していますか? – Piyush

答えて

0

置きますEditText sおよびScrollView内部Button。中に入っているものはどれもScrollViewです。だからあなたの問題は解決されます。

ScrollViewは1人の子供しかホストできません。だから、ジュリア趙の答えは、それがRelativeLayoutを使用して、正しいがViewGroup

LinearLayout様または RelativeLayout

内のすべてのあなたのView Sを配置する必要があります。 RelativeLayoutを使用する場合は、Viewを上下に表示させるためにさらに多くの作業を行う必要があります。ですから、LinearLayoutandroid:orientation="vertical"を使用することをお勧めします。余分な労力をかけずに自動的に1つ下にViewを置きます。だから、他のものに重複するようなものはありません。View

<?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="wrap_content"> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:orientation="vertical"> 

     <EditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="UserName"/> 

     <EditText 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:hint="Password"/> 

     <Button 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="10dp" 
      android:text="Login"/> 
    </LinearLayout> 

</ScrollView> 
+0

ありがとうございます。 – inc

0

ScrollViewですべてを入れ子にすると、これが役立ちます。

<?xml version="1.0" encoding="utf-8"?> 
<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <RelativeLayout 
     android:id="@id/RLayout" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:background="#000000" 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     > 

       // Your code 

    </RelativeLayout> 

</ScrollView> 
関連する問題