I have some parts of the screen that stay permanent and one part of the screen which is a container that should change its content to one of a set of Card elements, according to a button press on a button group.
If I understand correctly I cannot use the Tab-Navigator (or the Stack-Navigator) because those control a full page (i.e. screen) change, and I only want to swap a single card element.
Am I correct about that?
If so what do I need to do? Is there some existing UI element for this? If nothing exists, how would I go about doing this? Each card loads different stuff from a local json, and I don't want to reload them when switching back and forth...
I want it to have the effect shown in Android UI (non react-native) samples: android Navigation Tabs in middle of screen
Perhaps I should be using swiper like in this answer? implement tabs in the center of the screen .
You can use a tab navigator, think about a structure like the one below
<View>
<OtherStuffThatFilLTheScreen>
<TabNavigator>
<OtherRandomStuff>
<View>
Tab navigator will have full control of the element that renders inside its space, but will not change other elements outside its scope
Related
I often put user registration on one xml file with scroll view.
I have learned when a user sees too many fields they opt out of the app so I am planning to upgrade the layout to look like the one for gmail when you sign up on android app. It appears to be using tabbed view but not tabs available and user navigates to the next view by clicking next (refer to attached images).
First page
second page
MY QUESTION
My question is how do I create this views, do I need many xml layout files or put all stuff on one file and use visibility as in once it is filled and user presses next hide the inputs and reveal the next inputs. Note: Gmail appears to be scrolling to another page the way it would appear when using tabs.
You can use one activity to host multiple fragments. The new Android Studio update has Navigation Editor which you can use to achieve similar results.
it is totally up to you how you want to design this but the best thing is you use Fragment and viewpager instead of using two separate layouts.
See Here how to use fragment with viewpager
There are many ways to do this, If you have less content then play with visibility otherwise ViewFipper ( https://abhiandroid.com/ui/viewflipper ) Or can use Fragments
I am new to writing Android apps, I have been using the internet and Android Studio to create an app for my club as a bit of fun and learn along the way. I have been watching videos, using tutorials and walkthroughs and I am getting to learn the basics.
However, I have got stuck. I used a drawer template from Android Studio and added the activities I needed and buttons on the main screen to the activities and they all worked fine, no overlapping. When I tried to link the drawer icons to the activities, rather than use the buttons on the main screen, they work, but the app (visually) puts the next activities content on top of the one before.
I cant find anything on the internet except something called backstacking, but that is described when the back arrow is used, my problem is to do with selecting an activity from the drawer menu. I have attached a picture to show what I mean. It gets worse the more menu items that are selected.
If anyone could help, it would be great!
If you are using XML root layout as a constraint layout maybe your constraints are missing. If you are using constraint layout set both top/bottom and left/right constraint.
If your constraints only top for example it is look good on desing but in device that dont know where to positioning left or right and automatically positioning 0 point to top.
When you click one any one menu item put the visibility of other images as gone like
visibility(View.GONE);
and the one selected to be visible
Here is the image/snapshot of present UI but top headers (Select Discipline,Select Location)are getting so many spaces in screen and my whole required screen is getting short So whats the alternative of design this screen using Android.This screen contents are generated dynamically from Web Service.
Whats the way to remove top buttons and where should i need to place top buttons functionality so that after removal of button my contents will be more prominent?
Make the UI Top header a combo box
I'm porting an iPhone+iPad app to Android. It uses a Split View Controller for tablets which in Android lingo allows you to present two Activities side by side simultaneously (Edit: Android only allows one Activity on screen as mentioned by #commonsware below. The next best thing is to use fragments, but the Action Bar can only exist at the Activity level, meaning it will have to expand the entire width of the screen. It wonder if a Split Activity Controller will be coming to the Android Platform.)
The tablet landscape layout has a fixed left pane for statistics that never changes. The right hand pane functions just like the phone version of the app. Transitions occur exclusively on the right hand pane. i.e. the whole screen doesn't slide when changing activities, only the right pane. How would you recommend implementing this in Android?
Should I use a single activity and manually perform transitions between fragments in the right panel? This app has 25 screens and will have an alternate layout for phones, so I'm trying to plan ahead and do this right the first time :) Thanks for your help!
It uses a Split View Controller for tablets which in Android lingo allows you to present two Activities side by side simultaneously.
No. In "Android lingo", you cannot "present two Activities side by side simultaneously". You can present two fragments side by side simultaneously.
How would you recommend implementing this in Android?
Use fragments. Use a FragmentTransaction to replace the right-hand fragment as needed based on user input. Your overall activity layout could have a horizontal LinearLayout (with android:layout_weight to control the sizes for the left and right sides), with a <fragment> element for the left and a FrameLayout for the right.
Should I use a single activity and manually perform transitions between fragments in the right panel?
Yes, to achieve what you ask for.
I am not sure what the proper term is, but I am trying to add a "TitleBar" to the top of one of the windows in my App. Much like the Contacts App, I have several Tabs along the top of the screen. When you select an item from the list, it loads the next Activity, but that Activity no longer has the Tabs at the top of the screen.
I don't know if it is called a TitleBar or what. The Contacts App has this TitleBar along the top of the screen when you select a person from the list of Contacts.
I am trying to mimick the Grey Bar that says "George Washington"
The Contacts app is open source (as are most of the core Android system apps). I suggest checking it out and looking at the layout you want to emulate. In general, poking around a lot of that code is a good idea to get a handle on some best practices, or just to borrow a few tricks.
In this particular case, they're using a custom View called ContactHeaderWidget, which is actually a FrameLayout wrapping a TextView and Checkbox (styled to look like a star), along with the photo view (which has some special behavior to bind with the multiple contact source data on click and so on).
If you just want the look and not the functionality, though, just adding a LinearLayout with a GradientDrawable background containing an ImageView, a TextView, and a Checkbox styled as a star to your activity's layout should get you there a lot more easily without requiring custom widgets.