2016-10-21 3 views
0

私は自分のアプリに入っているときにキーボードを入力するだけでなく、アプリケーションのすべての要素が表示されます。 editTextとそのボタンをどのようにして他の要素が自分の位置を保持できるようにすることができるのかを知りたいです。これは私のコード(単にコーディング始まった)です:私にとって入力時にeditTextの位置を変更するだけです。

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout 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" 
    tools:context="com.jochem.chatbot.MainActivity" 
    android:background="#ffffff"> 

    <ImageButton 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/imageButton" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentEnd="true" 
     android:src="@mipmap/ic_launcher" 
     android:background="#00ffffff" 
     android:onClick="changeText" /> 

    <EditText 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/editText" 
     android:layout_alignBottom="@+id/imageButton" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:layout_toLeftOf="@+id/imageButton" 
     android:layout_toStartOf="@+id/imageButton" 
     android:textSize="20dp" 
     android:textColor="#000000" 
     android:hint="Yeah, typ something" 
     android:textColorHint="#505050"/> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Typ something" 
     android:id="@+id/textView" 
     android:layout_alignParentTop="true" 
     android:layout_alignLeft="@+id/editText" 
     android:layout_alignStart="@+id/editText" 
     android:layout_alignRight="@+id/imageButton" 
     android:layout_alignEnd="@+id/imageButton" 
     android:textColor="#000000" 
     android:textSize="25dp" /> 

</RelativeLayout> 
+0

コードを表示します。 –

+0

さて、私はそれをやった! –

+0

マニフェストファイルのタグで、この属性をandroid:windowSoftInputMode = "adjustPan"を追加してみることはできますか? –

答えて

関連する問題