2016-04-05 3 views
0

У меня есть edittext и ниже этого изображения, а затем 3 textviews. когда я пытаюсь ввести текст, текст 3 отображается правильно. Но когда я добавляю изображение и пытаюсь ввести текст в edittext, изображение отображается поверх edittext, значит, изображение перекрывает edittext.изображение перекрытие edittext при вводе

XML:

<ScrollView 
    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" 
    android:fillViewport="true" 
    android:background="#ffffffff"> 



<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" android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".Main" 
    android:paddingStart="5dp"> 

    <TextView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/userDisplay" 
     android:text="Username" 
     android:textColor="#ff6aa9ff" 
     android:textSize="20sp" 
     android:textStyle="bold"/> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:id="@+id/FName" 
     android:hint="FName" 
     android:background="#ffffffff" 
     android:gravity="start|left" 
     android:inputType="textFilter|textMultiLine" 
     android:maxLength="150" 

     android:layout_alignParentRight="true" 
     android:layout_alignParentEnd="true" 
     android:layout_below="@+id/userDisplay" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:text="Camera" 
     android:id="@+id/Camera" 
     android:paddingTop="7dp" 
     android:paddingBottom="7dp" 
     android:background="#ffffffff" 
     android:textSize="21sp" 
     android:drawableLeft="@drawable/compact" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:text="Gallery" 
     android:id="@+id/Gallery" 
     android:paddingTop="7dp" 
     android:paddingBottom="7dp" 
     android:paddingLeft="7dp" 
     android:background="#ffffffff" 
     android:drawableLeft="@drawable/gallery" 
     android:textSize="21sp" 
     android:layout_alignTop="@+id/Camera" 
     android:layout_centerHorizontal="true" 
     android:layout_alignBottom="@+id/Camera" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceSmall" 
     android:text=" Post" 
     android:id="@+id/Post" 
     android:paddingTop="7dp" 
     android:paddingBottom="7dp" 
     android:paddingLeft="5dp" 
     android:paddingRight="5dp" 
     android:background="#ffff5654" 
     android:textSize="21sp" 
     android:textStyle="bold" 
     android:textColor="#ff000000" 
     android:drawableLeft="@drawable/plane" 
     android:layout_alignTop="@+id/Gallery" 
     android:layout_alignParentRight="true" 
     android:layout_alignBottom="@+id/Gallery" /> 

    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="180dp" 
     android:id="@+id/image" 
     android:contentDescription="@string/abc_action_bar_home_description" 
     android:layout_marginBottom="76dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentEnd="true" /> 


</RelativeLayout> 
</ScrollView> 

и в файле манифеста Android я упоминают следующую строку деятельности. Пробовал, удалив нижнюю строку, но такое же поведение видно.

android:windowSoftInputMode="stateHidden|adjustResize" 

Какие изменения я могу сделать, чтобы избежать этого

+0

У вас есть 'android: layout_alignParentRight =" true " android: layout_alignParentEnd =" true "' как в EditText, так и в ImageView. Это вызывает проблему? – notsopopularguy

+0

Удалены эти линии и протестированы. Такое же поведение. – user2269164

+0

Попробуйте android: windowSoftInputMode = "adjustPan" –

ответ

1

, если вы хотите, чтобы you'r изображение будет «под» вашей EditText, поместить изображение в первой позиции

как

RelativeLayout 
ImageView 
EditText 
EditText 
EditText 
RelativeLayout 

после того, как вы хотите, чтобы у всех был такой же самый паз, что и все, что внутри LinearLayout, как

RelativeLayout 
    ImageView 
    LinearLayout 
    EditText 
    EditText 
    EditText 
    LinearLayout 
    RelativeLayout 

что-то подобное

0

Использования LinearLayout с orientation="vertical" если вы не хотите, чтобы перекрывать изображение и текст ..

или

Если вы хотите, чтобы перекрывать TextViews и EditText над изображением пытается поставить ImageView в начале относительной компоновки или установить его в фоновом режиме RelativeLayout.

Смежные вопросы