ViewPager containing SurfaceView dows not show other fragments while swiping away from SurfaceView - actionbarsherlock

My setup is the following. I have an Activity with 3 Fragments in a ViewPager. The first and the last Fragment are inflated via xml whereas the center Fragment is a Class derived directly from SurfaceView. This Class has its own rendering thread.
The Project uses ActionBarSherlock 4.0.2 and also the Support Library V4+.
Problem:
When the SurfaceView is shown and I swipe to one of the other Fragments these Fragments are not rendered during the transition. IOW instead of scrolling in the other Fragments the SurcaceView leaves behind previous rendered artefacts (smear).
Once the transition is completed the target Fragment is shown though.
Swiping from one of the outer Fragments to the SurfaceView in the center works as expected.
Possibly related problem:
When using the tabs in the ActionBar to perform the transition instead of swiping the target Fragments are not rendered at all. Although nothing is rendered the controls are active. Eg pressing the (invisible) buttons causes the assigned actions. This causes a refresh making the view visible.
instead of posting the source code I put it all on GitHub
I have tried a lot to find the root cause of the behaviour but to no avail.
Using another non SurfaceView Fragment in the middle works fine.
Wrapping the SurfaceView in a LinearLayout View did not make a
difference.
Switching off the Threadand all custom drawing inside the SurfaceView
had no effect.
Any ideas, suggestions and ideas are welcome.

Related

Child window not getting invalidated when the parent window has CLIP_CHILDREN and CLIP_SIBLINGS style

In my Application, there is a modeless dialog box which has one static control and some customized controls - Edit box, buttons. Actually we are enhancing the functionality of this dialog and added 2 more static controls. The dialog box has CLIP_SIBLINGS and CLIP_CHILDREN styles.
The Problem I am facing is in WinXP, when some other window gets overlapped on this dialog, every other control is getting painted properly except the newly added static controls. But there is no particular difference between the existing static controls and the ones I added.
This is solved with explicitly calling Invalidate method of the static control in dialog's OnPaint() method, but still I didn't get why the existing controls are painted fine.
I tried removing CLIP_CHILDREN style, then it worked fine but there is a lot of flickering.
Please help me understand the same, I have gone through so many threads relating to the same but I didn't find the answer.

Android action bar home button not including activity title

I am using the home button of the main Activity of my IM app to allow the user to change their availability status. My app is using ActionBarSherlock, which falls back to the native implementation where supported.
However, the size of the tappable area is inconsistent between Android releases:
On Android 4.2.0 and before (including the compatibility library), only the icon is tappable:
On Android 4.2.1+, icon and activity name are tappable:
How can I make the tappable area consistently include icon and activity title on all versions of Android?
I am using ActionBarCompat (and you should probably update, if you haven't already), so this may not behave exactly the same. I wanted the full title to be clickable for using the navigation drawer. For some reason, using a custom logo instead of the text makes the whole thing automatically clickable, where only the icon could be clicked before:
final ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayUseLogoEnabled(true);
actionBar.setLogo(R.drawable.im_title);
I don't know if it's possible to trigger that change while still using text with the default icon, but the setDisplay... methods and flags may be a good place to start looking.

uiwebview preventing access to buttons on uitoolbar

Am I thick or what? I have a view controller, and within that there is a UIWebView. When I run the app, the WebView covers the UIToolbar at the bottom and the UIButtons there, and so you cannot navigate away from the WebView. I cannot figure out how to change the WebView size or behaviour.
Unfortunately I do not have sufficient rep to post screenshots. The WebView displays an html file with text. The WebView partially covers the status bar at the top and completely covers the taskbar at the bottom. I can touch and drag the view up to see the taskbar and buttons at the bottom, but cannot use them.
I am using storyboard to build the app, and have done similar apps before without issue (in iOS6) but iOS7 appears to have thrown me a curveball.
I cannot see how to change the size in Xcode - or should I be looking at the html code in the file that the WebView is calling?
Oddly enough this is no longer an issue, I have not made any changes to code or config, and the only thing different is I upgraded my version of X-Code

OnTouchListener for a view in Jelly Bean

I have a game Activity, which contains a SurfaceView that fills the whole screen.
The app is declared as fullscreen, and appears as such.
My SurfaceView has an OnTouchListener, which feeds a GestureDetector, with a functionality that works fine on most devices.
The listener is set as simply as:
surface.setOnTouchListener(listener);
However, on Jelly Bean (Nexus 4) , touching the soft buttons (back, home, etc.) generates a touch event in coordinates that are irrelevant to my SurfaceView.
This currently generates weird behaviors.
I can workaround that by simply doing a check on touch events and see if they fit the surface size.
However, I was wondering if there is a more elegant solution - one that will just give me the touch events ONLY from my surface and not from those soft buttons.
This is also crucial in the case that some future devices do different variations of that (putting the soft buttons in the UPPER area, for example).

How to have multiple layouts in one activity in android?

What i want in my activity is two buttons on the top in one single line.. and below that i want a framelayout in which i want an imageview and i wil add my custom view on the top of imageview. I tried a lot but i am having a lot of confusion.
Shown in the image below is somewhat like i want.
I want to use framelayout because i want to add my custom view over my imageview. But if i add button on framelayout it comes above the image. It is getting really confusing and messy for me.
I did'nt know that we could nest two layouts in a single activity. I nested LinearLayout with FrameLayout and my problem got solved.. Cheers!

Resources