Top margin in FrameLayout always at the bottom in Android < 4 -


i trying add margin view hierarchy.
have framelayout root view, of course can use android.r.layout.content, not important in case.

<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent" android:layout_height="match_parent">     <framelayout         android:id="@+id/fragment_cont"         android:layout_width="match_parent"         android:layout_height="match_parent"/>     <include layout="@layout/toolbar"         android:layout_gravity="top"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:id="@+id/mytoolbar"         /> </framelayout> 

and current fragment layout quite simple

<com.github.ksoichiro.android.observablescrollview.observablerecyclerview     android:id="@+id/scrollable"     android:layout_width="match_parent"     android:layout_height="match_parent"     xmlns:android="http://schemas.android.com/apk/res/android" /> 

this gives me simple screen toolbar on top. not add screenshot not waste space. toolbar overlays first item of list.

if try add margins

<com.github.ksoichiro.android.observablescrollview.observablerecyclerview     android:id="@+id/scrollable"     android:layout_margintop="?actionbarsize"     android:layout_width="match_parent"     android:layout_height="match_parent"     xmlns:android="http://schemas.android.com/apk/res/android" /> 

i next result first screenshot android 4+, second android 2.3.
enter image description hereenter image description here

so margin @ bottom.

padding works expected.

personally me there no difference use margin or padding need animate hiding , appearing of toolbar.
no post question ask here.

what more lightweight framework, opengl, video accelerator render padding (inside layout) or margin (outside layout), in both cases view has redrawn, wonder better use.

my animation simple

valueanimator animator = valueanimator.offloat(viewhelper.gettranslationy(mtoolbar), totranslationy).setduration(200);         animator.addupdatelistener(new valueanimator.animatorupdatelistener() {             @override             public void onanimationupdate(valueanimator animation) {                 float translationy = (float) animation.getanimatedvalue();                 viewhelper.settranslationy(mtoolbar, translationy);                 viewgroup rootviewgroup = ((viewgroup) getview().getparent());  is possible root layout way ? or heavy ?                  rootviewgroup.setpadding(0, (int) translationy + mtoolbar.getheight(),0,0);              }         }); 

is bug in framework there should approach older versions of android ?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -