I want to create tabs inside the fragment(not a activity). How can I achieve this? Please tell me some thing about it or tutorial will be good idea.
If you want to add a Tabs into a fragment, let do it in onCreateView() method of framgent, I think everything is nomal
Related
I am A beginner at android. I have created an app which loads news from JSON to recycler view. I want to open an activity when the user swipes from left to right. I tried different methods but it doesn't work for me. Please help.
You have to create an activity first and put a view pager in it and switch between fragments : ( its better to use fragments at this kind of situations, u can swipe between ur fragments by using android view pager )
Here is a great link that gonna help you :
https://medium.com/#kyroschow/how-to-use-viewpager-for-navigating-between-fragments-with-tablayout-a28b4cf92c42
Have a good day
The better option is to use one Activity & other Fragments. And then use Viewpager for swipe between fragments. Follow below link:
https://developer.android.com/training/animation/screen-slide
I want to make tabView inside a fragment. I have template from this and I want to place tabView inside one fragment. Can I implement this like implementation using activity? Any tutorial or advice about this case? Thank you.
Yes. You can use ViewPager and TabLayout
(see http://developer.android.com/training/animation/screen-slide.html)
There are two ways to add the tabs inside fragment:
TabLayout: Using this layout you can add tab in your fragment and also latest approach provided by android.
Tabhost- Using old tabhost layout. This approach is a depreciated approach. However it will also work with fragment properly.
For more reference you can check my example on GitHub-Material Navigation
I've only been learning android for a few days now (beginner) and I'm quite not able to create a ViewPager as fine as these:
Is it possible to create a ViewPager inside a Fragment. If so any clue on how to proceed with creating such?
As a side note can some also please answer this question: I read somewhere that nested Fragments are possible, is that how these apps are created?
could you put a ViewPager in a fragmnet? Yes, Is this what they are doing? I dont know.
Quick example of setting up nested fragments is here
It could be an activity with a viewpager at the top in a scrollview too
You can do this. You have to use ViewFlipper and have multiple layouts within that PageViewer, each will be a "page." Here is a good tutorial on how to use this.
http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/
Think I have an activity with some layouts, I want to know is it possible to use layouts in activity for thats activity ViewPager items ?
is it possible ? if so , how ?
thanks
You should use a ViewPager, where each page holds a Fragment. This sample code explains how it can be done.
If you want your application to support pre-Honeycomb devices, you'll want to use the ViewPager and Fragments from the Android Support Package.
You can use viewpager with fragment. See the sample code below. I think this will be helpful for you.
http://developer.android.com/resources/samples/Support13Demos/src/com/example/android/supportv13/app/FragmentPagerSupport.html
How to put Expanded List inside a Fragment Tab?
I have 3 fragments in one page, The 2nd Fragment consist of two tabs,I want to put an expanded List inside the second tab.please help ,Thanks :)
Correct me if I am wrong in assuming that you are using ListFragment to show the lists. If you want to use a ExpandableListView you are going to have to implement it yourself inside a normal Fragment since there is no ExpandableListFragment implemented in the APIs.
Here is a link to Android's documentation on how to implement it: http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.html
Hope it helps.