I am writing an Android app but cannot figure out how to have a layout over another layout that can animate up and down to show and hide its contents, but have the bottom layout's imageview, shrink to fit the new area.
An example of what I am trying to do is in this iPhone app.
http://itunes.apple.com/gb/app/alex-ze-pirate-comic/id526432227?mt=8
Screenshots 2 & 4 show the states that I mean. When the top layout goes down to leave just the toolbar, the imageview gets taller to use the extra space provided.
Hope you understand me.
Thanks,
Ashley
The ImageView in this case will stay the same. Your second View will simply be covering it for some time. You can achieve this effect using a sliding drawer.
Related
I want to place a toolbar at the bottom similar to the below, sample post compose, screenshot highlighted in green.
But the toolbar should be pushed up when the keypad comes up while entering text as below sample screenshot.
I can design the button toolbar, but no idea how to make it always visible when using keypad. Request to provide sample code for achieving this.
There are two modes for how Android can display the screen with the keyboard up- resize or pan. In pan, the application is scrolled up such that the cursor is assured to be on the page. In resize, the app is resized to fill the space left after the keyboard isplays.
You want resize. But that's not sufficient. Your layout for the screen needs to be such that the toolbar is fixed to the bottom of the screen and that the stuff above it is flexible in size. The best way to do this is to use a RelativeLayout or ConstraintLayout for the root, and to put the toolbar to align to the parent on its bottom. Make that top bar with the post button do the same with the top. Then have the stuff between them be fill_parent and have it layout below the top bar and above the bottom bar.
The end result of all that is that the top and bottom bars will be put in a fixed position, and the center part will be laid out inbetween. Note that this could result in some elements not appearing on screen until the keyboard is dismissed, because they won't fit. Putting the contents in a ScrollView can mitigate that problem, so the user could scroll to it.
I need to design layout like image below and also I want such that when I press the button which is on top of image to slide up this layout having images.
You can achieve this by implementing bottom sheets.
I am giving you a perfect link for all types of bottom sheet examples, follow it you'll get the result.
Bottom Sheets
Initially an image will be shown having upto 1/3 of screen height and full screen width. (android.support.v7.widget.)Toolbar will be gone.
I want to animate ImageView (when page is scrolled up) to be part of Toolbar and make the toolbar visible. While scrolling down reverse action should happen.
Edit:
Similar animation can be found here. There is a minor change though, the image of giraffe will move on the toolbar and appear between left arrow and text "item 4". The animation has to be like Shared view or Hero view but on the same activity.
http://antonioleiva.com/collapsing-toolbar-layout/
How can this animation be done?
Everything is simpler with the new Android Design Library
Build The Design Library Adding This Link In Your Gradle File
compile "com.android.support:design:23.1.0"
You can achieve exactly this effect by following Below Code
https://github.com/saulmm/CoordinatorBehaviorExample
http://blog.grafixartist.com/toolbar-animation-with-android-design-support-library/
I hope you can achieve the functionality using the CoordinatorLayout which was launched in the new Design Library.
Please check this example http://antonioleiva.com/coordinator-layout/
I'm making use of Siyamed's menu item in my app.. I would like to place the menu item in the bottom center of the screen.. and when I click on it, the child items should surround the center icon. Any ideas on how to start?
I recommend you tried another implementation: ArcMenu by daCapricorn.
As the author said on Google+:
If you want to put it align the screen bottom, you can set alignparentbottom="true" in xml and compute the marginBottom (it should be negative) programmatically.
PS: I personnality ended up using ArcMenu library rather than SatelliteMenu for the same issue.
I'm trying to write a simple wikipedia app for Android 2.2 which allows users to search and view articles.
When a user is viewing an article, I'd like there to be a fixed position search bar that remains fixed at the top of the screen, despite the vertical scroll position, as in this picture:
http://img839.imageshack.us/img839/9159/wikidroid01.png
How can I implement that search bar? Is it a view I stick in my layout? I've already read about Search Dialog boxes in this android tutorial (http://developer.android.com/guide/topics/search/search-dialog.html)... but it's my understanding that the search dialog box search bar can only show if it is focused (when onSearchRequested() is run), right?
Thanks for the help!
You can do it by taking relative layout of fixed height. In that relative layout add the elements in order that you have shown in picture like
1) Imageview with wrap_content height & width.
2) Take Editext with fixed height & width also set Hint for that EditText="Search WikiPedia".
Put this layout as first element in your main layout so that it will be always at top if vertical scroll is there it will not scroll that search bar.
You can use fragments. They allow you to have 2 (or more) views that are controlled separately. Read more here.
Fragments are new to Android 3.0 however there is a compatibility pack that allows you to use them as early as Android 1.6.