2015-12-18 3 views
0

Я пытаюсь настроить свой экран при загрузке мягкой клавиатуры. Обычный экран выглядит так. enter image description hereSoft keyboard issure

Однако, когда пользователь нажимает на EditText, представление нарушается и появляется следующим образом. В моем манифесте для деятельности я добавил следующее андроида: windowSoftInputMode = «adjustResize» enter image description here

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

Редактировать: добавление следующей строки в мою деятельность getWindow(). SetSoftInputMode (WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN); сделал мой взгляд похожим на это. Но я все еще хочу, чтобы мои две кнопки появляются в нижней части EditText enter image description here

XML для нижней EditText и кнопки

<LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1.6 " 
     android:background="#FFFFFF" 
     android:orientation="vertical"> 

     <LinearLayout 

      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_weight="1"> 

      <EditText 

       android:hint="Enter your Message" 
       android:ems="10" 
       android:id="@+id/messageET" 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_weight="1" /> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_weight="1"> 

       <RelativeLayout 
        android:background="@drawable/lightrectangle" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_weight="2.5"> 

        <ImageButton 
         android:id="@+id/addimgbtn" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_centerVertical="true" 
         android:background="#f6f6f6" 
         android:paddingLeft="10dp" 
         android:src="@mipmap/blueadd" /> 

        <TextView 
         android:paddingLeft="10dp" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="Add an image" 
         android:id="@+id/textView4" 
         android:layout_centerVertical="true" 
         android:layout_toRightOf="@+id/addimgbtn" 
         /> 
       </RelativeLayout> 


       <RelativeLayout 
        android:background="@drawable/lightrectangle" 
        android:layout_width="fill_parent" 
        android:layout_height="fill_parent" 
        android:layout_weight="2.5"> 

        <ImageButton 
         android:id="@+id/sendbtn" 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:layout_centerVertical="true" 
         android:paddingLeft="10dp" 
         android:layout_weight="2.5" 
         android:background="#f6f6f6" 
         android:src="@mipmap/bluesend" /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textAppearance="?android:attr/textAppearanceSmall" 
         android:text="Send Message" 
         android:id="@+id/sendmsgTV" 
         android:layout_centerVertical="true" 
         android:layout_toRightOf="@+id/sendbtn" 
         android:paddingLeft="10dp" 
         /> 
       </RelativeLayout> 
      </LinearLayout> 
    </LinearLayout> 
+0

Вы будете иметь, чтобы получить возможность отправлять по крайней мере упрощенную версию вашего макета. Изменение размера - это то, что вы хотите, но должно быть представление, которое на самом деле может изменить размер. –

+0

@GabeSechan, что мне нужно изменить? – revipod

+0

Этот центральный список должен быть усадочным. –

ответ

1

Добавить поля или расположение внутри вид прокрутки это будет автоматически отрегулируйте макет. Вы можете прокручивать макет, и он автоматически настраивается на всех экранах.

<LinearLayout 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:layout_weight="1.6 " 
android:background="#FFFFFF" 
android:orientation="vertical" > 

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" > 

     <EditText 
      android:id="@+id/messageET" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_weight="1" 
      android:ems="10" 
      android:hint="Enter your Message" /> 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_weight="1" > 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_weight="2.5" 
      android:background="@drawable/lightrectangle" > 

      <ImageButton 
       android:id="@+id/addimgbtn" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:background="#f6f6f6" 
       android:paddingLeft="10dp" 
       android:src="@mipmap/blueadd" /> 

      <TextView 
       android:id="@+id/textView4" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_toRightOf="@+id/addimgbtn" 
       android:paddingLeft="10dp" 
       android:text="Add an image" 
       android:textAppearance="?android:attr/textAppearanceSmall" /> 
     </RelativeLayout> 

     <RelativeLayout 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_weight="2.5" 
      android:background="@drawable/lightrectangle" > 

      <ImageButton 
       android:id="@+id/sendbtn" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_weight="2.5" 
       android:background="#f6f6f6" 
       android:paddingLeft="10dp" 
       android:src="@mipmap/bluesend" /> 

      <TextView 
       android:id="@+id/sendmsgTV" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerVertical="true" 
       android:layout_toRightOf="@+id/sendbtn" 
       android:paddingLeft="10dp" 
       android:text="Send Message" 
       android:textAppearance="?android:attr/textAppearanceSmall" /> 
     </RelativeLayout> 
    </LinearLayout> 
</ScrollView> 

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