2016-09-14 3 views
0

すべてのまあ最初は、次の画像Androidの浮動レイアウトのEditText(赤線)に何かを書こうとイムは、その後、緑色のレイアウトはもう表示されていないとき

enter image description here

を見て、緑色のレイアウトを浮かべて、タイトルバーのように(青色のレイアウトはRecyclerviewで、一部が隠れていても気にしない)、常に緑色のものが表示されます。 LinearLayout、どうすればそのようなことをすることができますか?ここ

はXMLです:

<?xml version="1.0" encoding="utf-8"?> 
<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" 

tools:context="com.me.something.lolz"> 
<LinearLayout 
    android:weightSum="100" 
    android:orientation="vertical" 
    android:id="@+id/llBanner" 
    android:background="@color/colorVika" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    > 

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


     <ImageButton 
      android:id="@+id/back_one" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="?android:attr/selectableItemBackground" 
      android:src="@drawable/back"/> 

     <ImageButton 
      android:id="@+id/something_menu" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="?android:attr/selectableItemBackground" 
      android:src="@drawable/nBUtc" 
      android:layout_gravity="center" 
      android:layout_alignParentTop="true" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentEnd="true" /> 

     <ImageButton 
      android:id="@+id/btnOpti" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:background="?android:attr/selectableItemBackground" 
      android:src="@drawable/optie" 
      android:layout_alignParentTop="true" 
      android:layout_centerHorizontal="true" /> 


    </RelativeLayout> 







    <TextView 
     android:id="@+id/tvholy" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="lala" 
     android:layout_gravity="center_horizontal" /> 
</LinearLayout> 
<android.support.v7.widget.RecyclerView 
    android:layout_below="@+id/llBanner" 
    android:id="@+id/rvME" 
    android:layout_marginLeft="20dp" 
    android:layout_marginRight="20dp" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:scrollbarAlwaysDrawVerticalTrack="true" 
    android:scrollbars="vertical" 
    android:layout_above="@+id/linearLayout" /> 

<LinearLayout 
    android:id="@+id/linearLayout" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentLeft="true" 
    android:layout_alignParentStart="true" 
    android:orientation="vertical"> 



    <LinearLayout 
     android:id="@+id/linearLayout1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentLeft="true" 
     android:layout_alignParentStart="true" 
     android:orientation="horizontal"> 

     <EditText 
      android:layout_marginLeft="20dp" 
      android:layout_marginRight="20dp" 
      android:id="@+id/etText" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:layout_weight="1" /> 


     <ImageButton 
      android:id="@+id/btnSave" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="bottom" 
      android:background="@drawable/savetton" 
      android:text="d"/> 


    </LinearLayout> 
</LinearLayout> 


</RelativeLayout> 

青レイアウトのサイズを変更する場合は、私は

+0

マニフェストファイルのアクティビティに 'adjustPan'を使用します。 – Piyush

+1

@Piyush dosent work ... – secret

+0

xmlファイルを表示... – Piyush

答えて

0

が上の追加...それはそれで重要なボタンがありますので、私はちょうど緑のレイアウトを気にし、気にしませんAndroidManifest.xml

<activity 
     ............... 
     android:windowSoftInputMode="stateHidden|adjustPan"/> 

の場合、またはあなたの活動上の次のコードではない作品で、使用してみてください:

+0

それはdosent仕事のトップレイアウトはまだdosentフロート..... – secret

0

LinearLayoutの外に緑色のレイアウトを配置すると、そのレイアウトは常に表示され、ルートの相対レイアウトの下に配置されます。例:

<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"> 

    <LinearLayout 
    android:id="@+id/greenLayout" 
    android:layout_width="match_parent" 
    android:layout_height="100dp" 
    android:orientation="vertical" 
    android:background="@color/colorPrimaryDark" /> 

    <android.support.v7.widget.RecyclerView 
    android:layout_below="@+id/greenLayout" 
    android:id="@+id/recyleView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_above="@+id/editText" /> 
    <EditText 
    android:id="@+id/editText" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    /> 
.... 

</RelativeLayout> 
+1

youreの例は私が何をしたかと同じです.....緑レイアウト(私の例では、私の例では、llBanner)は、ルート。それと同じ方法であなたの書いた....あなたが私のコードでそれをやろうとすることができ、問題が何であるかを見ることができれば...それはまだ消滅し、用量はトップに固執するから。 – secret

+0

私は試して、私は私のために働いた。 –

関連する問題