-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GlassActionBar and NavigationDrawer #7
Comments
Sorry Martin but I don't have time to devote to the library at the moment. On Mon, Jun 30, 2014 at 11:05 PM, Martin [email protected] wrote:
|
Can you give me any tip how to do this? Maybe I will do some sample. |
I've been trying to implement it and I believe that instead of using helper.createView() on your activity::onCreate() you might be able to use the helper on your fragment::onCreateView() and instead of using the inflater to inflate your fragment you simply pass your fragment layout (The one you would inflate using the inflater and return as the result of fragment::onCreateView()) to the helper.createView function...Ex: On your Fragment
Though this is partially working here...the view is loaded and added correctly to the screen but the problem arrives when I try to scroll the scrollview because this exception gets thrown:
|
Here's what I found now, I started a blank project with activity + fragment. Using the bootstrap code from the Android Studio I changed:
After those changes I simply ran the app and it crashes but (strangely!) no exception is to be seen on the logcat..oh yeah I'm using genymotion! Then I proceed to add an ImageView inside the NotifiyingScrollView, like so:
Et voila, it works but it is necessary to have an ImageView as the first child on the LinearLayout..not quite sure why but I didn't look at the GlassActionbarHelper code properly! |
Another finding...if the height of the LinearLayout is less than the height of the ActionBar the exception that I posted earlier is thrown ( "java.lang.IllegalArgumentException: y + height must be <= bitmap.height()" ) and my previous comment about the first item needing to be an ImageView isn't totally true, I tried the following layout:
and this is the result: http://i.imgur.com/HcZKwZ1.png Maybe some more values checks should be done in order to prevent ANR and probably there could be support for non scroll/list views Edit 1: Another finding lol..if your layout contains a view with visibility set to gone then the same exception as before will be present...my 2 cents here is that when there's a view set to gone, for example, one of the the TextViews above, the measured sizes will return 0 for the wrapping view and this is causing the bitmap created from the container view to have width and height of -1 so when we try to run "Bitmap actionBarSection = Bitmap.createBitmap(...)" it throws the exception.. Any ideas to circumvent this situation? Edit2: Another conclusion that I made! The measurements are made when theres a OnGlobalLayout and in my case I am loading images using the UniversalImageLoader meaning that they have their loading and rendering deferred.. my conclusion here is that when you have something that is loaded and presented asynchronously on your view you need to somehow "block" the execution of the GlassActionbarHelper code until your view is completely loaded otherwise the first time it runs the OnGlobalLayout handler the view width/height might be -1 resulting on the IllegalArgumentException! |
Will you do sample app using NavigationDrawer and GlassActionBar?
The text was updated successfully, but these errors were encountered: