2017-01-05 8 views
1

私は数時間迷惑な問題に直面しています。固定の余白でAndroid adjustResize

私はmarginTopとbottomに整列したボタンを持つロゴの相対的なレイアウトを持っていますが、それにはmarginBottomがあります。これらの2つのビューの間には、他のいくつかのビューが中央に配置されています。

enter image description here

キーボードを開いたときに問題が発生します。私は何が起こりたいのすべてを持ち上げている。ボタンが持ち上げられ、ロゴが固定された位置に残り、他のビューが途中で押し下げられる(小さなデバイスでも消える)場合があります。

enter image description here

私は他のすべてのビューは、ロゴやボタンから始めて、互いに対してであるかどう問題を解決することができる(決して両方!)知っています。しかし、この場合、ロゴとボタンは希望の場所にはありません。

アイデアをいただければ幸いです。

+0

はRelativeLayoutに他のものの景色を入れscrollview –

+0

でそれを入れてみてください。あなたの問題を解決するかもしれない – Moses

+0

@KoenVanLooveren私はすでにスクロールビューに入れています – Teodora

答えて

0

私はあなたがここにdiscribe何を試してみました:

は真FILLVIEWPORT =を忘れないでください。 scrollview

のためにこれは、私は考え出したものであり、それは完璧に動作します:

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

    <RelativeLayout 
     android:id="@+id/activity_main" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     tools:context="be.vanlooverenkoen.testing.MainActivity"> 

     <ImageView 
      android:id="@+id/imageView" 
      android:layout_width="wrap_content" 
      android:layout_height="150dp" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" 
      android:scaleType="fitXY" 
      app:srcCompat="@mipmap/ic_launcher" /> 

     <EditText 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_above="@+id/button" 
      android:layout_below="@+id/imageView" 
      android:background="@color/colorAccent" /> 

     <Button 
      android:id="@+id/button" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_alignParentBottom="true" 
      android:text="Button" /> 
    </RelativeLayout> 
</ScrollView> 
+0

はい、動作しますが、edittextは圧縮されています。私の場合は、ロゴのアンドロイド:layout_marginTop = "50dp"とボタンのアンドロイド:layout_marginBottom = "100dp"があるので、編集テキストのサイズはさらに小さくなります(時には消えてしまいます)。 – Teodora

関連する問題