Android Navigation Drawer over GLSurfaceView - android

Drawer placed over glSurface behaves wrong. It ignores layout width and height. Animation is bad too.
I took the sample project BasicGLSurfaceView from Android SDK and applied this official manual to it.
If i set glSurface's visibility to invisible or remove it and change to any another View everything is okay.
Am i doing something wrong?
UPD1: Just tried to set some solid color as background for drawer. Now it looks acceptable - width and height just as the supposed to be. And the shadow in its place. But animation still twitches.

I got it solved with workaround described here (just place dummy empty View over GLSurfaceView): DrawerLayout ListView not drawn with GLSurfaceView as content

Related

React Native DrawerLayout: shadow on child appears on iOS but not on Android

I have an app that uses Expo's GestureHandler.DrawerLayout with the "back" drawer style, such that the view rests atop a stationary drawer and slides off to reveal it. To emphasize this arrangement, I wanted to add a drop shadow to the content View, cast on the drawer content. So far, I have this working on iOS but not on Android.
To explore this in isolation from the rest of my app, I've forked the react-native-gesture-handler project and modified the horizontalDrawer example app. I've added style props for the shadow here:
https://github.com/kmagiera/react-native-gesture-handler/compare/2542bd39503412ef00883e0e799caf7d1f68ef3a...brettdh:shadows-broken-on-android
As you can see in this screenshot, the shadow appears on iOS, but not on Android. However, if I remove absolute positioning by commenting out this line, I see that the shadow is actually being clipped on the left, as you can see in this screenshot.
I've dug into the component tree a bit and tried:
moving the shadow props to a wrapper View
clearing overflow: hidden
(though now my understanding is that overflow: visible only works on iOS)
I've found discussions describing this as having something to do with absolute positioning, but even if that's the case, I don't think I can avoid that, as it's part of the DrawerLayout itself. Any thoughts as to how I can accomplish the same shadow effect on both iOS and Android?
Some further investigation indicates that DrawerLayout puts a View around my component that's (probably) clipping the shadow. If I put my elevation prop on that View instead (along with a backgroundColor), the shadow is no longer clipped.
This probably means that I need to make a PR to enable custom styles on this wrapper View.

Android Tabs with overlaying / overlapping Image

i have a conceptual android question. I use the appcompat library (API min:15, target:21).
And want to place an image over the Top-Tabs (or even within) and the content below. (Content could be a swipeView)
Like this:
Important is that the image should be fixed within the last tab and laying over the content below. (should be fragment independent)
How would you do it?
Is there something new in Api 21 that can handle this easily?
Thanks!!
API 21 will not make this easier. What you can make use of API21 is ViewOutline to make your floating action view oval.
However, positioning of the view is likely unrelated to the API version. You need to place the floating button between your tabs holder and content layout. Oval view bottom should be aligned with content and has the bottom margin usually to the half of it's height.

Tips at start-up or update

I have an update for my app that includes ActionBarSherlock with a sliding menu. I have put my navigation entirely in to the sliding menu, leaving my main_activity pretty bare. I am worried the user won't know about the menu. So I want to add a prompt at start-up that will highlight the new feature. Like this:
I am not even sure what this is called, so I don't know how to research it. Any help or suggestions will be rewarded. Thanks!
You could just use overlay layout (Frame layout with multiple inner layouts will fit perfectly. Please note Frame Layout Z axis is by the lower the layout is in the xml, so the guide should be the last in the XML). Make that layout's background mostly transparent and add buttons and design to fit your needs. When you don't want to show the layout just set visibility to gone. And when you need it set to visible.

Android Background color changes using ViewPager in ICS

When I flip through the pages of a ViewPager, the background of a LinearLayout keeps changing from the grey color set in the Theme to white, and it do that only when flipping through pages, only in portrait mode and only in ICS.
It's perfectly working in all previous versions of Android.
EDIT: It looks like it's caused by the tag android:ellipsize="marquee" in the layout xml file.
How can I avoid this issue?
I find this thread
Android Viewpager saving data and views
By using view_pager.setOffscreenPageLimit(4);, this problem is solved (however, you can still see the white background for the first run, but it will work after that). Adjust the integer parameter according to your use ;)

Gmail tablet style scroll bars with transparent actionbar

I've been trying stuff and searching for the last couple of hours and got no where so I thought I'd ask here.
Basically the Honeycomb version of Gmail has a listview on the right for it's message list and when you scroll the listview the items go under the actionbar which appears to have some form of gradient on it with #00FFFFFF at the bottom going up to #FFFFFFFF at the top giving the impression of the items fading out.
But they important thing to notice here is that the SCROLLBAR on the listview never goes underneath the ActionBar! and the default top position for the listview is underneath the scrollbar.
I've tried to implement a similar style layout for my app with a scrollview that scrolls underneath the actionbar which has an alpha set on it, it looks all nice and well but the scrollbars go underneath as well! :( and it makes it look a bit weird, it's not a nice option.
I've achieved what I have so far by using
getWindow().requestFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
and
getActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.actionbar_bg));
which is a an XML drawable that simply has a color of #BB000000 (no gradient just yet)
this is the current effect, the scrollbar can be seen underneath the actionbar :(
this is the desired effect with the scrollbar never going into the actionbar but the content does scroll up underneath it
Edit: I think this probably uses something custom in Google and have all but given up figuring it out
call this before super.onCreate(savedInstanceState); in onCreate of your activity
requestWindowFeature(Window.FEATURE_ACTION_BAR_OVERLAY);
More: http://developer.android.com/reference/android/view/Window.html#FEATURE_ACTION_BAR_OVERLAY
I can't see an easy way of doing this but I have come up with two possible solutions. There could well be a much better option that I couldn't see obviously.
The first and easiest, is to create a 9patch background file for you ActionBar that has an expanding gradient area and a fixed opaque area at the right hand side, the same side as your scroll bar. This way the scrollbar would still go under the ActionBar, but it would be hidden. However it would have the affect of the scrollbar disappearing / getting smaller.
Another option would be to edit the scrollbar thumb in the xml like this:
<ListView android:scrollbarThumbVertical="#drawable/YOUR_CUSTOM_THUMB" ></ListView>
Then create a scrollbar thumb with a transparent offset at the top.
Thinking about it I think the second option is probably the best to go for and will give you the best result. I realise it's a pretty crappy hack. Looking into a code way of doing it, I think you would have to extend a number of classes and override a load of methods.
simply use:
getActionBar().setBackgroundDrawable(null);

Categories

Resources