Overlaying Action Bar - Android Studio Tutorial -


run small problem while working android tutorial http://developer.android.com/training/basics/actionbar/overlaying.html

i have created custom action bar theme android:windowactionbaroverlay property has been set true.

<!-- theme applied application or activity --> <style name="customactionbartheme"     parent="@style/theme.appcompat.light.darkactionbar">     <item name="android:windowactionbaroverlay">true</item>      <!-- support library compatibility -->     <item name="windowactionbaroverlay">true</item> </style> 

i applied theme entire application in manifest

<application     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:theme="@style/customactionbartheme"  > 

the problem bar covering parts of app needed remain visible. added following app said , fixed first view (where type in message , hit send)

android:paddingtop="attr/actionbarsize" 

however following activity, supposed display message, still covered action bar. want know add top padding can fix view well. did little searching , found layout 'display message' activity defined in .java file (atleast think is)

//create text view     textview textview = new textview(this);     textview.settextsize(40);     textview.settext(message);      //set text view activity layout     setcontentview(textview); 

i tried doing textview.setpadding() function takes ints arguments can't pass "attr/actionbarsize"

to reiterate: need figuring out layout display message activity , how can edit can set top padding did main view.

thanks!

you can actionbar height int:

int actionbarheight = 0;  typedvalue tv = new typedvalue(); if (gettheme().resolveattribute(android.r.attr.actionbarsize, tv, true)) {     actionbarheight = typedvalue.complextodimensionpixelsize(tv.data, getresources().getdisplaymetrics()); } 

and can use value setpadding() or setmargins().

or can add top margin/padding second activity layout file, it's hard without looking @ code or xml layout files of activities.


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 -