2013-10-10 3 views
1

Я новичок в android. Я делаю приложение, используя карту google. В файле макета 3 части i.e Верхний слой, средний слой, нижний слой. В верхнем слое заголовок, в нижней кнопке TAB. В фрагменте срединного слоя и редактировании текста. Когда я нажимаю на поле редактирования, то фрагмент увеличивается. когда фрагмент возвращается в позицию, тогда верхний слой будет невидимым. Я не знаю, что произойдет.Map Layout Issue

<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:background="@drawable/bg" 
tools:context=".MainActivity" > 

<RelativeLayout 
    android:id="@+id/topLay" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/jam_alert_topbar" 
    > 
</RelativeLayout> 

<RelativeLayout 
    android:id="@+id/midLay" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_above="@+id/botLay" 
    android:layout_below="@+id/topLay" 
    android:layout_margin="10dp" > 

    <fragment 
     android:id="@+id/mapView" 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@+id/descr" 
     android:layout_below="@+id/topLay" 
     class="com.google.android.gms.maps.SupportMapFragment" /> 

    <EditText 
     android:id="@+id/descr" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentRight="true" 
     android:layout_marginTop="5dp" 
     android:background="@color/white" 
     android:gravity="top|left" 
     android:hint="Description" 
     android:maxLines="4" 
     android:minLines="4" > 
    </EditText> 
</RelativeLayout> 

<LinearLayout 
    android:id="@+id/botLay" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:gravity="center" > 

    <Button 
     android:id="@+id/btReport" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/jam_tab_n" 
     android:onClick="btReport" /> 

    <Button 
     android:id="@+id/btMap" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/map_tab_h" 
     android:onClick="btMap" /> 

    <Button 
     android:id="@+id/btHome" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/report_tab_n" 
     android:onClick="btHome" /> 

    <Button 
     android:id="@+id/btSetting" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="@drawable/settings_tab_n" 
     android:onClick="btSetting" /> 
</LinearLayout> 

ответ

1

Попробуйте это, вы пробовали этот ?. Добавить атрибут windowSoftInputMode в частности активность

android:windowSoftInputMode="adjustPan" 

В вашем xml. добавить андроид: layout_alinParentTop = «истина» в вашей верхней RelativeLayout

<RelativeLayout 
android:id="@+id/topLay" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/jam_alert_topbar" 
android:layout_alinParentTop="true" 
> 
</RelativeLayout> 
+1

я попробовал это Android: windowSoftInputMode = «ststeHidden/adjustresize» он работает, но он перемещает все 3 слоя сверху и я хочу, чтобы следующее å выше 2 слоя вверх –

+0

такая же проблема Извините :( –

+1

pleae do helful for me @Murli Ganesan –

0
// try this 
<LinearLayout 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:orientation="vertical" 
       android:background="@drawable/bg" 
       tools:context=".MainActivity" > 

    <LinearLayout 
      android:id="@+id/topLay" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:orientation="horizontal" 
      android:background="@drawable/jam_alert_topbar"> 
    </LinearLayout> 

    <LinearLayout 
      android:id="@+id/midLay" 
      android:layout_width="match_parent" 
      android:layout_height="0dp" 
      android:layout_weight="1" 
      android:orientation="vertical" 
      android:layout_margin="10dp" > 

     <fragment 
       android:id="@+id/mapView" 
       android:layout_width="fill_parent" 
       android:layout_height="0dp" 
       android:layout_weight="1" 
       class="com.google.android.gms.maps.SupportMapFragment" /> 

     <EditText 
       android:id="@+id/descr" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="5dp" 
       android:background="@color/white" 
       android:gravity="top|left" 
       android:hint="Description" 
       android:maxLines="4" 
       android:minLines="4" > 
     </EditText> 
    </LinearLayout> 

    <LinearLayout 
      android:id="@+id/botLay" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:gravity="center" > 

     <Button 
       android:id="@+id/btReport" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/jam_tab_n" 
       android:onClick="btReport" /> 

     <Button 
       android:id="@+id/btMap" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/map_tab_h" 
       android:onClick="btMap" /> 

     <Button 
       android:id="@+id/btHome" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/report_tab_n" 
       android:onClick="btHome" /> 

     <Button 
       android:id="@+id/btSetting" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/settings_tab_n" 
       android:onClick="btSetting" /> 
    </LinearLayout> 
</LinearLayout> 
+0

сэр я хочу сделать это для нескольких экранов не только для экрана singla –