2016-03-03 1 views
0

У меня странная проблема. Когда я устанавливаю Text Alignment моего EditText в центр, клавиатура не поднимает его. EditText остается за клавиатурой (скрыт). Почему это? Что я должен сделать, чтобы снять EditText над клавиатурой. EditText помещается в LinearLayout и что все помещается в FrameLayout внизу. Спасибо!Android TextAlignment в EditText перестает поднимать клавиатуру

Edit (код макета):

<FrameLayout 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=".ProfileChooseActivity" 
    android:scrollIndicators="none" 
    android:background="@drawable/bg_run4"> 

    <!-- The primary full-screen view. This can be replaced with whatever view 
    is needed to present your content, e.g. VideoView, SurfaceView, 
    TextureView, etc. --> 

    <!-- This FrameLayout insets its children based on system windows using 
    android:fitsSystemWindows. --> 

    <LinearLayout 
    android:orientation="vertical" 
    android:layout_width="233dp" 
    android:layout_height="159dp" 
    android:layout_gravity="start|bottom" 
    android:layout_margin="10dp"> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:inputType="textPersonName" 
     android:ems="10" 
     android:id="@+id/profileNameEditText" 
     android:layout_margin="10dp" 
     android:backgroundTint="#97f8720b" 
     android:hint="@string/profile_name" 
     android:textCursorDrawable="@null" 
     android:layout_marginTop="20dp" 
     android:textColor="#3d3131" 
     android:textAlignment="center"/> 

    <Button 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="@string/enter_profile" 
     android:id="@+id/enterProfileButton" 
     android:layout_gravity="center_horizontal" 
     android:background="#97f8720b" 
     android:singleLine="false" 
     android:clickable="true" 
     android:layout_marginLeft="10dp" 
     android:layout_marginRight="10dp" 
     /> 
    </LinearLayout> 
</FrameLayout> 

ответ

1

Я копировал файл макета, как вы описали, и все работает. Может возникнуть проблема с вашим макетом.

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
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"> 

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

    <EditText 
     android:id="@+id/edittext" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_gravity="bottom" 
     android:textAlignment="center"/> 

</LinearLayout> 

</FrameLayout> 

enter image description here

+0

Он по-прежнему не работает. Странно, когда я удаляю выравнивание текста, это работает ... –

+0

Это вызывает ту же проблему. –

+0

Можете ли вы показать свой файл макета тогда – Inducesmile

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