Android Studio Tabhost in scrollview always at top - scrollview

I have a tabhost in android studio that is inside a scroll view. The tabhost itself lies underneath some text.
Here is an image of the xml file
However, whenever i open the app on a device, the scroll view has the tabhost set at the top so i have to scroll up to see the text that is above it.
Why is this and is there a fix?
Thanks in advance.

The TabHost is the first view that can request focus. So the work-around is to have another focusable view at the top of the LinearLayout within the ScrollView.
I used the following View for this purpose
<View android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px"/>
Note: I was heavily inspired by TabHost inside a ScrollView forces it it to scroll to the bottom and Stop EditText from gaining focus at Activity startup.

Related

How do I fix empty 44px space in iOS7 view with ViewDeckController?

I am in the process of transitioning an app to iOS7. All of the views throughout the app have a 44px empty space at the bottom that appears to be for a bottom toolbar or something, but I am not trying to display a bottom toolbar. This space also exists on views that do have a bottom toolbar and the toolbar just shows directly above it.
The red space shown is actually a view behind the black view. No matter what size I set the frame of the black view to, the red space is always shown. I am also hiding the status bar in plist, so don't know if this is an artifact from that or if it has something to do with navigation bar as they are both normally 44px in height.
I have looked at the transitioning guide and haven't found anything that's worked. Any ideas to what could be causing this and how to fix?
UPDATE:
I have tried setting edgesForExtendedLayout = UIRectEdgeAll and extendedLayoutIncludesOpaqueBars = YES (also tried NO) with no effect. When I look at the subviews of the navigation controller it shows a UIToolBar as hidden, but shows it contains a frame in the exact area the view refuses to resize to even with autolayout constraints.
UPDATE 2:
This is actually a problem with ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets it's center view bounds.
I believe it has to do with the UINavigationBar. Try toggling the following options in Storyboard and see if it solves the problem. Namely, the 'Extend Edges' options:
These options can also be set in code with the edgesForExtendedLayout and extendedLayoutIncludesOpaqueBars properties on UIViewController.
If you are transitioning to iOS 7, you should be using an Auto Layout constraint to anchor to the Bottom Layout guide. Control drag from your view to the Bottom Layout guide and choose Vertical Space from the popup menu.
Using frames in iOS 7 is harder and is the way of the past.
Auto Layout is hard to grasp at first, but it is very powerful once you get the feel.
This is actually a problem with third party library ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets centerViewBounds for IIViewDeckControllerIntegrated. I was able to figure it out after changing to IIViewDeckControllerContained and seeing the view sized correctly.
In IIViewDeckController.m, just return self.referenceBounds for iOS7 like it does for IIViewDeckControllerContained.

Facebook App Style UIImageView

I have bunch of images inside a UIScrollView and have a tap event setup on each image. When I try to make the image full screen it actually is cut off by the scroll view. I am trying to implement a Facebook style UIImageView where the image zoom in and takes over the full screen on tap.
Does anyone have suggestion on how to approach this cause the way I am doing the image is cropped to the size of the scroll view.
Well, usually you would disable clipping, but the scrollview relies on clipping to do its job so that won't work.
My suggestion would be to push a copy of the image above the scrollview, and animate that to full screen. You should be able to get the rect using convertRect:toView: and it would be pretty straightforward from there.
btw, Is there a reason not to use a tableView for this?
When tapped hide the image and add the image at the proper place in the scrollview superview and over the scrollview. Then animate it to take the full screen.
Facebook App style UIImageView is nicely implemented in below given source code, you can take a clue from this
https://github.com/michaelhenry/MHFacebookImageViewer

uibutton dosnt respond to touch when at a location

Bit of a strange one.
I have a UIButton which works when located anywhere on the view except the top left hand corner when in landscape mode.
I have a navigation bar with a back button nested in the same area but when the the video enters full screen and playback state changes this navigation bar is hidden.
any ideas?
As thought, the problem was occuring due to the hidden navigation bar and the navigation item located in the same place.
The only solution i can find was to remove the navigation bar from superview then add it back when needed.
Your view's hierarchy is not properly configured. To properly configure your hierarchy, you need to navigate to either the xib or storyboard that you're working with, and re-order the button so that it's on top of anything that falls within it's similar bounds. A common example is that you added a UIView, which is clear, and you had the button underneath it, and now you can't interact with it even though you can't see it.

Can't seem to achieve the same effect on my slide menu as Any.Do

I am trying to create the same type of slide-up/pull-up menu (from the bottom) as the Any.do iPhone app, but not having any success.
The issue I am running into is the app was built with storyboards so I am thinking I might have to scratch that idea and use just code.
Any ideas?
There is no need to get rid of your storyboard to recreate this, that's what IBOutlets are for. Any way, it looks like this was made by creating a UIScrollView that takes up the entire screen. Then add a UITableView to the upper section of the scroll view. Mind you in order for this to work, you'll need to disable scrolling on the scroll view in the background.
From there you can programmatically add the other elements to the scroll view to be rendered off screen, since there are only three they can probably just be buttons. And finally, since scrolling is disabled on the background scroll view you can add an image with a UISwipeGestureRecognizer at the bottom of the screen to manually change the scroll view's content offset property.

UIScrollView. How to use the scroll bar on the side?

I'm working with Xcode developing for iOS using a UIScrollView. I got the scrollview working just fine.
But my issue/question is dealing with how to use the scrollbar on the side of the scrollview:
For example, I have dynamically created 2000 buttons inside the scrollview, in the simulator. The buttons are lined up vertically, so I have to scroll down to see all of the buttons. I do not want to simulate scrolling 30 to 40 times in order to get to the 1500th button.
I have the code to go to the last button, and to scroll to top. But I was wondering if there is anyone that can give insights on whether I can use the scroll bar on the side of that scrollview in order to help me navigate the scrolling better.
That bad boy isn't a scroll bar. It's simply a visual indicator of the current location. There are ways to scroll programmatically, but I'm not sure that's really what you want to do.