Impossible to add a footer to a ScrollView - android -


i'm working on mobile app , have problem when try put footer under scroll view.

here code:

<relativelayout     android:id="@+id/relativelayout01"     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent">        <relativelayout          android:layout_alignparentbottom="true"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:id="@+id/bottomcontent"         android:orientation="vertical"         android:background="@drawable/border">             //the footer added dynamically     </relativelayout>  <scrollview     android:layout_weight="1"     android:id="@+id/scroller"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:fillviewport="true" >     <linearlayout         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:orientation="vertical"         android:id="@+id/contentcontainer">         <linearlayout             android:id="@+id/scrollcontentcontainer"             android:orientation="vertical"             android:layout_width="fill_parent"             android:layout_height="wrap_content">             //the content added dynamically layout template         </linearlayout>     </linearlayout> </scrollview> </relativelayout> 

the content of scrollview set of relative layout buttons , textviews inside. it's based on layout i'm inflating several times.

the footer linearlayout buttons in well.

the thing tried different solutions found on internet , none of them working. in case footer stuck under content of scrollview, not under scrollview itselfm have scroll down until content on reach footer. footer supposed remain on bottom of screen...

i tried solutions well, nothing working: - http://www.javacodegeeks.com/2013/10/android-fixed-header-and-footer-with-scrollable-content-layout-example.html (when try have footer on top of screen , nothing else...) - http://www.byteslounge.com/tutorials/android-fixed-header-and-footer-with-scrollable-content-layout-example , others (not working well!)

i tried possible things using gravity, weight, fillviewport, align bottom... impossible have expected result. minimum api set 14, use android studio.

thanks guys!

edit1 : border drawable `enter code here

<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android" >     <item         android:bottom="-2dp"         android:left="-2dp"         android:right="-2dp"         android:top="2dp">         <shape android:shape="rectangle" >             <stroke                 android:width="1dp"                 android:color="#000000" />              <solid android:color="#3b010101" />              <padding android:left="10dp"                 android:right="10dp"                 android:top="10dp"                 android:bottom="10dp" />         </shape>     </item>  </layer-list> 

you can try following, had troubles adding scrollview inside relavelayout.

<relativelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:id="@+id/relativelayout01"     android:layout_width="fill_parent"     android:layout_height="fill_parent">      <relativelayout         android:id="@+id/bottomcontent"         android:layout_width="fill_parent"         android:layout_height="wrap_content"         android:layout_alignparentbottom="true"         android:background="@drawable/border">         <!---add there eg:-->        <button         android:layout_width="fill_parent"         android:layout_height="wrap_content"          android:text="test"/>       </relativelayout>       <scrollview         android:id="@+id/scroller"         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:layout_above="@id/bottomcontent"         android:layout_alignparenttop="true">          <linearlayout             android:id="@+id/contentcontainer"             android:layout_width="fill_parent"             android:layout_height="wrap_content"             android:orientation="vertical">              <linearlayout                 android:id="@+id/scrollcontentcontainer"                 android:layout_width="fill_parent"                 android:layout_height="wrap_content"                 android:orientation="vertical">              </linearlayout>         </linearlayout>     </scrollview> </relativelayout> 

enter image description here.

i found following in this documentation. causing problem sure

note: in platform version 17 , lower, relativelayout affected measurement bug cause child views measured incorrect measurespec values. (see measurespec.makemeasurespec more details.) triggered when relativelayout container placed in scrolling container, such scrollview or horizontalscrollview. if custom view not equipped measure measurespec mode unspecified placed in relativelayout, silently work anyway relativelayout pass large at_most measurespec instead.

this behavior has been preserved apps set android:targetsdkversion="17" or older in manifest's uses-sdk tag compatibility. apps targeting sdk version 18 or newer receive correct behavior


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -