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
Related
I am building a Xamarin Android app and need to make a design choice. I am still rather new in Android development, and don't know any other developers in my area personally that I can ask for help on this matter.
The app has a "BottomBar" with several buttons / tabs. If a button is clicked, a new screen should appear.
All 4 screens contain a lot of data, mostly lists (or RecycleViews?) of images with text and when clicking on a listItem or similar, an associated detail screen should appear.
At this point I wrote code that loads new activities when I click on one of the bottombar buttons. E.G., btnA loads activityA, btnB loads activityB and so on. The BottomBar is regenerated in each new activity and also keeps track of its instance State, so if I am in activityA and click on btnB, ActivityB loads and in activityB btnB is highlighted as the active tab, without me having to write a single line of code. Basically, this is working great out of the box.
I am wondering however if I should add a big fragment container in a host activity, and load different fragments in that container on BottomBar button clicks instead. Maybe this approach has a performance benefit or some other benefits that I am not aware of as yet. As for now, we don't have any intentions to create a tablet version, we only want to create a mobile version of the app. I understand that I can reuse fragments with a bigger screen estate (tablets), but this should not be necessary.
Again, everything is working ok as it is, but I am only at the beginning of building the app, and would like to make good design choices early.
The BottomBar component that I am using (Xamarin c#):
https://github.com/pocheshire/BottomNavigationBar
The above version is a port of this (Java):
https://github.com/roughike/BottomBar
Any advice is appreciated...
Sorry for long waiting.
If you want to follow the path that Google recommends in their guides that you need swap the fragments in the container by pressing the tab.
Link to Google guides
I know it should be in the style sheet area for this, but when I created a new Android app using Android Studio, it has a user logo and user information in a green box. This is what I want to edit.
First it should ask them to login if first time using the app.
But let's deal with one thing at a time, and first is me getting use to where Google puts things.
If you look at your layout activiy you will find a "NavigationView", there are 2 attributes there you need "header" and "menu".
You can see in this answer how.to get the views inside the "header" file: https://stackoverflow.com/a/33631797/4017501
There is another alternative. The "NavigationView" is a ViewGroup. So you can use it as such. Delete thee "header" and "menu" attribute and add the closing brackets as if were a ViewGroup:
<NavigationView></NavigationView>
Now you can simply put a fragment inside and then find every view and handle your logic from the fragment, is a more direct and customizable approach.
I have existed code for two activities(ActivityA and ActivityB).
Now I need to have a another activity, which will act as my first and only screen of my application. This activity will be having two tabs on its header part and I need to display each of my Activity when user press on each tab.
I have done some search on this and found TabAcivity will be suitable choice, but it is deprecated now.
I saw many posts which are suggesting Fragments. But I dont want to change my existing code. Can any one suggest me easy method to incorporate this.
you can use Android Tab Layout with Swipeable Views
here i give Link in this link step by step information given. so i think you can get batter idea from that.
Tab Layout with Swipeable Views
you can also download code from this site and also see video in given sit
in my app I've launcher activity displaying summaries of different stuff. There's one SlidingDrawer set up in each activity having a dashboard with 9 menus as content. When user clicks on drawer's handle, content scrolls up to display that dashboard. These menu launch 9 activities from dashboard and there are no of activities that will be having same SlidingDrawer with dashboard.
Now the thing which is disturbing me is, I'm forced to put same code blocks in each activity that controls behaviour of dashboard. Dashboard itself is inflated from single layout. So design is not issue. But I've to attach event handlers to each button and start new activities from there. Problem is whenever I make changes I need to replicate those changes in all activities.
How can I avoid such redundant code and use a single class or something that let me define launching of those 9 activities?
Sorry for title and description. It's really hard for me to put it in words. If you find title or description not suitable then tell me or edit where appropriate.
Thanks.
This might be a perfect situation for an Android Fragment
Have two fragments for each activity, one for the sliding drawer and one for everything else.
Android fragments seem complex at first, but trust me, learning them will make your life easier.
in my app i am trying to implement the design of facebook homepage.
I have 7 different activities in my app. For all the 7 activities the buttons in the title(application bar) and footer part to be the same and same actions.
Now my question is, whether i have to create separate 7 layouts for all the 7 activities and i have to write the same button actions in each activity or it can be written once and can be used in all 7 activities ?
if it can be used by writing only once, how to do it pls suggest me a best way ?
You should probably create a Fragment that contains the buttons, an then reuse the Fragment in every Activity.
Check this out for more info about Fragments:
http://android-developers.blogspot.no/2011/02/android-30-fragments-api.html
you should create Header and Footer xml files separately
and then use "<include other layout>" Android Layout
to include your header and footer on each Screen.
let me clear if any doubt i have done this, very easy.
also you can check this SO thread