I'm currently designing the following 2 pane layout and I'm wondering on how to implement it.
Link to Wireframe
So far, I made a two pane activity. On the left is a custom ListView fragment. On the right is a detailpane. The detail pane is what I'm having trouble implementing. I don't know how to create a tab view that doesn't use the actionbar and I'm curious if the best way is to use a ton of fragments for the detailpane or just add change the data dynaically.
[The reason I don't want to use the action bar is that I'm using it for my Help/Refill buttons]
So what tools/tutorials/advice can anyone recommend in implementing this?
Additional information:
Categories or the Tabs will be based on a JSON array.
The listview inside the tabs will be filled with items from a JSON array.
Let me know if you need any more information.
I am currently using a FragmentTabHost and it's just perfect!
You can have your ListFragment and a simple Fragment with your details.
And use your FragmentActivity to communicate with them.
You just need to override the onAttach method of your activity which is called when a Fragment is displayed.
Related
I am making an app which has a navigation drawer. This navigation drawer has 50 menu items. These items have the same layout, same activity but different data.
I want to implement ViewPager in my app so that the user could swipe left and right (manually and automatically).
Issue: I am facing an issue of how to implement this. The activity (for these menu items) has its own methods and functionality. A ViewPager can slide fragments but my issue is that since all of these menu items have the same layout and functionality then it would be much better to use one fragment whose data change with swipes for each menu items.
I don't know how to approach this. Please guide me.
You can do it by using a recycleView,and you will need an arrayAdapter which will help you adapt the data accordingly and you will need to have a separate class that will have all the data you want, you can also have different constructor in that class. You can check this to know more https://www.codexpedia.com/android/a-very-simple-example-of-android-recyclerview/
im trying to implement an android aplication when your activity, cointains 3 or more 'main windows' like in the image -> 'A'. 'B'.'C'. so how is posible make when you slide you touch screen change from A, to B, for example, i was thinkin in a horizontal view, and inside of each item use a relative layout, but im not sure, its my first time with this kind of problem, thanks.
Try using android ViewPager. Each ImageView would be inside a Fragment that would reside inside your Activity. Check out this example
Use Tabbed Activity template when you want to make this type of Activity. ViewPager, Adapter and tab layout will be automatically implemented for you. Just make small changes in your Adapter according to your needs and use one Fragment for one tab and you can create as many tabs as you want in an Activity.
If you want i will post an example of an Adapter as i just implemented an Activity with 3 tabs.
To get your basics strong on ViewPager, tab layout and Fragment sections adapter read out this link.
I am a novice in developing android app ! I am working with Android Studio!
Want to implement a tab-panel in which some of the tabs (as this) will contain listview to hold some data or image from a json Webservice! While the data comes from internet connectivity so there is performance is a issue for me!
I have got two types of way to implement tabs in android! One is listactivity & other is fragment! I just want to know which of these two way is efficient for implementing tabs on android??
A listActivity is an activity, and you cannot bind a different activity to each tab-panel, but you can put a different fragment on each panel (or use a single container, and just replace the fragments there with transactions).
You can also use another fragment to display the tab-interface at the top, which remains constant as the contents below changes. Something you couldn't do if you were switching activities.
I'm using SlidingMenu lib to implement a sliding side menu. I can add a list view, or other views to the menu as: menu.setMenu(R.layout.static_list_layout); and it's working perfectly as wanted.
My needs are more than a static list, I used to have an activity that relies on an empty list_view and programmatically fill up the list according to user profile, the contents are dynamic.
Just as facebook left menu, where user groups are listed. I want to attach this same activity to dynamically fill the list in the menu. Is this possible? Any example code?
Even if you find a way to do it you shouldn't use an Activity for what you are describing.
The better option is to use a Fragment class, a quick search found me an example here:
Dynamic UI with sliding menu and actionbarsherlock
The good thing about fragments is that they have pretty much the same lifecycle as activities so you get all the things that an activity has.
The other option is to use your own view (that is extend it).
you can create a class that extends FrameLayout for example and add an inflated view to it. This will also enable you to write additional logic based on dynamic properties.
However i suggest you to look into fragments and do it the "fragments" way.
Activities span the full screen, this is not possible.
You can try to use a fragment however.
I am facing problem in designing following scenario :
Showing 3 tabs for contact-lists (all, friends and family)
All tabs would contain contact-list as per the groups
Any contact could be selected and viewed but should be in the same tab (either all,family or frnds)
In short, tabs should be available globally.
Here, I decided to use ActionBar and to change the view by using fragments to be called from onTabSelected() of TabListener; in which I was confused as I have to keep only single activity but multiple fragments.
'Keeping single activity' is this a standard / valid approach ? Please suggest.
Thanks in advance.
You should have a single Activity and have a container(could be an empty LinearLayout) in which fragments are replaced depending on the tab selected.
I know this is late, but I used a tabhost with fragments to do something similar. Here's a nice tutorial.
http://thepseudocoder.wordpress.com/2011/10/04/android-tabs-the-fragment-way/