I have a simple layout with:
- top bar (like action bar) with save and back button
- and below a scroll view with some
EditText
inside... (check the image below),
When I call keyboard, my view is push above... I would like my Top Bar to stay always visible and fixed on the top... (check below the image of what is happening and what I would like to happen)
I tried several solutions with android:windowSoftInputMode
, putting the top bar as relative layout and set isScrollContainer
in scrollview
but none have worked for me...
Code Below:
<RelativeLayout
android:id="@+id/llWriteCommentWall"
style="@style/TextSubSeparator"
android:layout_height="wrap_content"
android:layout_width="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
style="@style/TextSubSeparator"
android:layout_marginBottom="@dimen/margin_separator_bottom"
android:layout_alignParentTop="true">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="left|center_horizontal|center_vertical"
android:orientation="horizontal"
android:layout_marginTop="@dimen/margin_title_top"
android:layout_marginBottom="@dimen/margin_title_bottom"
android:layout_marginLeft="@dimen/margin_title_left"
android:layout_marginRight="@dimen/margin_title_right"
>
<ImageView
android:id="@+id/ivMainMenu"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/tk_btn_home"
android:onClick="clickHome"/>
</LinearLayout>
<TextView
android:id="@+id/tvSeconHeader"
android:text="@string/title"
android:layout_width="match_parent"
android:layout_weight="2.5"
android:layout_height="match_parent"
android:gravity="center"
style="@style/TextTileHealth"/>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:gravity="right|center_horizontal"
android:orientation="horizontal"
android:layout_marginTop="@dimen/margin_title_top"
android:layout_marginBottom="@dimen/margin_title_bottom"
android:layout_marginLeft="@dimen/margin_title_left"
android:layout_marginRight="@dimen/margin_title_right">
<ImageView
android:id="@+id/ivSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="fitCenter"
android:src="@drawable/tk_btn_tab_save"
android:onClick="clickSave"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:isScrollContainer="false">
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/margin_separator_bottom"
android:gravity="center">
<!-- EditBoxes -->
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<EditText
android:id="@+id/et1"
style="@style/TextEditBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:digits="0123456789."
android:inputType="numberDecimal"
android:maxLength="3"
android:layout_weight="0.33"
android:gravity="center"
android:ems="3"
android:layout_marginBottom="10dp"/>
<EditText
android:id="@+id/et2"
style="@style/TextEditBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:digits="0123456789."
android:inputType="numberDecimal"
android:maxLength="3"
android:layout_weight="0.33"
android:gravity="center"
android:ems="3"
android:layout_marginBottom="10dp"/>
<EditText
android:id="@+id/et3"
style="@style/TextEditBox"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:digits="0123456789."
android:inputType="numberDecimal"
android:maxLength="3"
android:layout_weight="0.33"
android:gravity="center"
android:ems="3"/>
</LinearLayout>
</LinearLayout>
</ScrollView>
And Manifest:
<activity
android:name="com.example.slyzer.gui.new.NewValue"
android:label="@string/app_name"
android:windowSoftInputMode="adjustResize"
android:screenOrientation="portrait">
</activity>
EDIT:
I recently find out, that when you put the activity as Full Screen:
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
, the windows starts to act different from usual: https://code.google.com/p/android/issues/detail?id=5497&q=fullscreen&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars
and as described by Dianne Hackborn in here, this is how it's working, and it seems that there is no interest in changing it.
So, I tried the Joseph Johnson's AndroidBug5497Workaround, but I always end up with a "extra" blank bar above my keyboard, and the View steel doesn't show as I want it to...
Does anyone have a nice/simple solution to this problem?