2016-03-21 24 views
1

Android:show softキーボードは、レイアウトの下部に実装された特定のEdittextをクリックした後、Edittextフィールドの半分を自動的にカバーします。 EditTextソフトキーボードにフォーカスを要求すると、レイアウトが上にシフトしますが、Edittextフィールドの半分を覆います。AndroidソフトキーボードカバーEdittext android

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="0.12" 
     android:background="@color/green" 
     android:orientation="horizontal"> 

     <LinearLayout 
      android:id="@+id/ll_back" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.6" 
      android:background="@drawable/btn_selector" 
      android:focusable="true" 
      android:focusableInTouchMode="true" 
      android:gravity="center" 
      android:orientation="horizontal"> 

      <ImageView 
       android:id="@+id/img_nav" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@drawable/ic_back" 
       android:focusableInTouchMode="true" /> 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/ll_circle" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:background="@drawable/btn_selector" 
      android:gravity="center_vertical|start" 
      android:orientation="horizontal"> 

      <de.hdodenhof.circleimageview.CircleImageView 
       android:id="@+id/circleView" 
       android:layout_width="@dimen/list_circle" 
       android:layout_height="@dimen/list_circle" 
       android:layout_gravity="center" 
       android:layout_margin="7dp" 
       android:src="@drawable/logo8" /> 
     </LinearLayout> 


     <LinearLayout 
      android:id="@+id/ll_id" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_marginLeft="5dp" 
      android:background="@drawable/btn_selector" 
      android:gravity="center_vertical" 
      android:orientation="vertical"> 

      <TextView 
       android:id="@+id/textView8" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="\@gaurav.yadav" 
       android:textColor="@android:color/white"/> 

      <TextView 
       android:id="@+id/textView81" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="1d" /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.3"></LinearLayout> 


     <LinearLayout 
      android:id="@+id/ll_p" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1.2" 
      android:gravity="center_vertical|right" 
      android:orientation="horizontal"> 


      <LinearLayout 
       android:id="@+id/ll" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_margin="10dp" 
       android:gravity="center" 
       android:orientation="horizontal"> 

      </LinearLayout> 

     </LinearLayout> 

     <LinearLayout 
      android:id="@+id/ll_post" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:background="@drawable/btn_selector" 
      android:gravity="center" 
      android:orientation="horizontal"> 

     </LinearLayout> 

    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="0.87" 
     android:orientation="vertical"> 


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

      <android.support.v7.widget.RecyclerView 
       android:id="@+id/RecyclerView_topcollege" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:scrollbars="vertical"> 

      </android.support.v7.widget.RecyclerView> 
     </LinearLayout> 

    </LinearLayout> 


    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0dp" 
     android:layout_weight="0.12" 
     android:gravity="center" 
     android:orientation="horizontal"> 

     <LinearLayout 
      android:id="@+id/ll_attachment" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.5" 
      android:gravity="center" 
      android:orientation="horizontal"> 

      <ImageView 
       android:id="@+id/imageView28" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:background="@android:drawable/ic_menu_gallery" /> 
     </LinearLayout> 

     <LinearLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_margin="10dp" 
      android:layout_weight="2" 
      android:background="@drawable/bg_edittext" 
      android:gravity="center" 
      android:orientation="horizontal"> 

      <LinearLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:layout_weight="2" 
       android:gravity="center" 
       android:orientation="horizontal"> 

       <EditText 
        android:id="@+id/editText" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:layout_marginLeft="5dp" 
        android:background="#00000000" 
        android:hint="Write a Answer...." 
        android:textSize="15sp" /> 
      </LinearLayout> 

      <LinearLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:layout_weight="0.5" 
       android:background="@android:drawable/ic_menu_send" 
       android:gravity="center" 
       android:orientation="horizontal"> 

       <ImageView 
        android:id="@+id/imageView27" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" /> 
      </LinearLayout> 
     </LinearLayout> 
    </LinearLayout> 

</LinearLayout> 
+1

あなたのコードをscrollviewの中に入れてください。 –

+0

http://stackoverflow.com/questions/20128193/soft-keyboard-hides-half-of-edittext –

+0

#Pankaj Ji @BhaveshRanganiのコメントに従います –

答えて

0

アクティビティクラスのために使用すると、1つのプロパティを設定するために持っているよりもダミーレイアウトにマニフェスト

android:windowSoftInputMode="stateHidden|adjustPan" 
0

、scrollviewにセットされたフラグを、あなたに必要なコードを入れてくださいまたはあなたのxmlの任意のビュー のような

  <LinearLayout 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:focusable="true" 
      android:orientation="vertical" > 
+0

これは質問に対する答えを提供しません。批評をしたり、著者の説明を求めるには、投稿の下にコメントを残してください。 - [レビューの投稿](レビュー/低品質の投稿/ 11713161) –

+0

あなたの知識で私の答えを改善して、そのようなコメントを追加することは素晴らしいことでしょう。そのようなコメントは、ユーザーが問題を解決するのに役立たないためです。私はより多くの情報とコメントのログについてユーザーに尋ねる世話をする。 –

+0

これは答えではなくコメントです。答えには、あなたのケースではSoftInputModeを隠しておく必要がある理由など、より良い説明が必要です。 –

0

、として設定された焦点に

 android:windowSoftInputMode="adjustResize"