Android Tabs with overlaying / overlapping Image - android

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.

Related

How can I make a image scrollbar in android studio like the ones on sites?

I want to make a scrollbar with a tiny little buttons on the bottom like the one on the images. what should I do?
first scene
second scene
you can use viewpager for that and for showing the dots you can make your custom drawable. and you can give height and width to main view according to your requirement, then it will work
You might thinking of using ViewPager and a ViewPagerIndicator.

Why don't two views with shared elevation join and form a seam?

I'm building this app that looks like this:
snapshot
Here's a break down of the structure of the app.
break down
It is as simple as this:
I need to constantly change the Fragment within the activity. What I want to achieve is to let the LinearLayout in the Fragment look like as if it is part of the app bar (that is, without shadow casted to it).
theoretically if I set the elevation of the LinearLayout equal to the app bar(4dp or 8dp or whatever), they should be able to bridge the step themselves, but no. Even if I set the elevation of the LinearLayout to 20, it still appears to be underneath the app bar.
Is there any way to tackle this?
Try to set android:elevation=0dp (or app:elevation=0dp on support AppBarLayout) and use gradient drawable to draw shadow.

Swipe/drag Android view from the bottom of the screen

I want to do in my app a View that I can swipe from the bottom of the window (Images below explain it better).
I want the view to stop at certain point. The view must allow to swipe/drag it to the bottom again. Any idea or tip of how can I do that?
I think you are in search of a ViewDragHelper:
API doc:
https://developer.android.com/reference/android/support/v4/widget/ViewDragHelper.html
How to use. This answer links to a sample project to show you how as well:
ViewDragHelper: how to use it?
Dragging best practices:
http://developer.android.com/training/gestures/scale.html
You can use the new material design pattern called Bottom Sheets.
They do the exact thing that you want. They also support custom layouts for the view.
Material Design - Component - Bottom Sheets

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 action Bar customization

my app is using using Sherlock action bar.
my designer gave me a new design.
the app logo need to be in the middle
2 action items to the left and 2 actionitems to the right of the logo
the app logo height is 1.5 the size of the actionbar (it suppose to be a little overflow)
is it possible to create a custom layout for the actionbar to implement this desing ?
or should i remove my actionbar and implement the design my own ?
if item #3 will be optional , does it changes your answers ?
Thanks
I'm sorry, but kick your designer in the...
He doesn't get Android at all and shouldn't design for Android. Either it's an ActionBar and then you should treat is as such and you (or your designer) should follow the common pattern on Android, or it is not.
If it is no ActionBar, please do not use an ActionBar (no matter which library) and create a custom design that deviates enough from an ActionBar so as not to confuse users!
Please forward your designer, and your manager to Android design patterns site at http://developer.android.com/design/patterns/actionbar.html . Also tell them that if they want Google to ever feature them, they pretty much have to adhere to these. With all failed use full screen layout and create a custom control on the top
I agree with other answers: that's not an action bar as defined by Android guidelines.
I'll just add that in case you can't go against the design decisions made (yeah, real-world projects sometimes suck and as a programmer you'll have to do what the client asks).
Go with your own implementation. I suggest simply creating a fragment with the appropriate listener interface (a common Android pattern, let the activity implement the interface, set the fragment's listener in onAttach).
If you want to implement this (and I pretty much agree with the other posters, that this is non-standard, and probably shouldn't be done).
You won't be able to create this style ActionBar with the standard APIs (or ActionBarSherlock for that matter) - since your UI is non-standard
You could create a RelativeLayout, with your icon in the center (centerInParent="true"). Then in the same layout, you could create a background, with width set to "fill_parent", and the height to 2/3 the size of your center icon (calculating this value in DP).
Then you can create ImageButtons for your 2 ActionItems to the left and to the right, then just put them in your layout relative to the center icon.
Bottom line, you probably should re-think your UI, to make this more standard to the design patterns specified by Android. If you still want to do it the way your designer asks, you will need to do a custom layout (using a RelativeLayout as I suggested is one way to accomplish the UI you are looking for).
You could create a RelativeLayout, with your icon in the center
centerInParent="true"
Then in the same layout, you could create a background, with width set to fill_parent, and the height to 2/3 the size of your center icon (calculating this value in DP).

Categories

Resources