android two activity in one screen - android

I want to implement one android activity that have a button inside of it. when this button is clicked , andother activity runs.
The second activity slides from left to right and get just 80% width of the screen , and the 20% remaining spaced should be filled by left side of first activity( first acitivity slides to right)
How can I implement it?
I think I should have two activity in one screen!

I think Android Does not support two activitis in single screen. insted of activities u can use fragments

Better you should use fragments .. Check here http://developer.android.com/training/basics/fragments/index.html

Related

Can you measure the height of a view on an activity that's not been loaded yet?

I want to make an animation on click that a button slides down to the position of another button and at the same time I'm loading another activity. This other button is on the new activity. Picture it as if a button from one activity is replacing a button on another activity, so it has to slide down to where the new button is.
Can I measure this new button's position before the activity is loaded? So I can get the animation right for all screen sizes.
Activities are designed to be used as full-screen components, meaning that you understand that the other activity that pops in is going to take the full screen. If that is your goal, you can use shared element transitions with the activities to get the desired effect: https://developer.android.com/training/transitions/start-activity#start-transition
On the other hand, if you need both activities to stay on the screen, than you should rather to use fragments, as activities are not suited for that. For more info on that approach, see here: https://developer.android.com/guide/navigation/navigation-animate-transitions

Android: Activity sliding over another one with swipe gesture

I have two activities one with some data and the second one, semitrasparent with some buttons on it.
I want the second activity slide over the first one after the swipe gesture.
I've already read about ViewPager and it's not what I am looking for. I want the first activity still being visible over the semitrasparent second one.
I am looking for any suggestions how to do this.
Literally not possible.
The entire point of an Activity is that it fills the ENTIRE screen, and there are never 2 of them shown at the same time, ever.
So you can't swipe to "semi" open one with a slide animation.
To do that, you'll have to use 1 Activity, and multiple Fragments.

How to alternate between fragment containers easily?

I've got a problem that I'm having problems solving. My app has 2 types of fragments. When the app starts, a fragment with main menu is added to a FrameLayout that I use as a fragment container. This fragment takes up the entire screen. Then, when I choose one of the items in the menu, a corresponding fragment should be loaded into the container, replacing the menu. However, this fragment must only take 1/4 of the screen from the left, and the space outside is to be used by some other fragment.
I was thinking about making 3 FrameLayouts, one for the left side, one for the right and one for the entire screen, but this is going to have problems with fragment transactions, since I would have to keep tabs on which fragments are where and remove them by hand.
Basically what I need is some way to change whether my fragments are loaded into a container that takes up full screen, or a container that takes up only some part of the screen. I probably could do it with tons of trail and error and some code, but I bet there is a really easy way to do this in android that I missed.
Instead of trying to dynamically load these fragments into the various containers, I would suggest having two different Activities.
It sounds like the main menu fragment will only ever appear on its own in full screen. So, make that a full Activity (let's call it MainMenuActivity).
The second activity will have two FrameLayouts as it's contents, with one taking up 1/4 of the screen and the other taking up the remaining 3/4. Load this second activity upon choosing a main menu option and populate the fragments in onCreate() of the second activity.
Hitting the back button from the second activity will return the user to MainMenuActivity.

swipe activity to change another activity in android and show multiple Activity in a singleview?

Hi i need to swipe on each activity page to change next view.How to animate a swipe effect in android.
how can i swipe the activity(Mi firstquestion)
My secoundquestion
show multiple Activity in a singleview?
for example I have 4 activity Activity(1,2,3,4). In screen the 2nd activity should show in the center the next two activity (2 and 3 Activity)corner shows in the left and right in the page and if he again swiple it should be (2,3,4) from(123)Activity. How can i do this
the image i need is below
If you have multiple Activities on one screen you should probably consider using Fragments instead. And for Swiping between Activities I would use a ViewPager and swipe between Fragments.
http://developer.android.com/guide/components/fragments.html
http://android-developers.blogspot.com/2011/08/horizontal-view-swiping-with-viewpager.html
http://thepseudocoder.wordpress.com/2011/10/05/android-page-swiping-using-viewpager/

Tabs disappears in TabActivity after it goes to other Activities

In my app I have four tabs in the bottom of my main screen. When the user click in one of the tabs in the bottom it open an Activity and the user needs to fill up a form, after the form is done it returns to one of the TabActivities.
Everything works well, except when the form is save its supposed to go to the Activity an show the four tabs in the bottom. The problem is that the tabs in the bottom disappear.
I thought the if Im calling the TabActivity it will always show the tabs that were assign in the XML layout.
Okay you have to go for ActivityGroups. But in later version of android Activity Group is deprecated and hence you have to go for fragments or views. Here are few links which will get you started.
ActivityGroup Example
http://blog.henriklarsentoft.com/2010/07/android-tabactivity-nested-activities/
http://united-coders.com/nico-heid/use-android-activitygroup-within-tabhost-to-show-different-activity

Categories

Resources