I have an Activity with a ViewPager inside.
The ViewPager has 3 pages.
I want to show my dropdown list only in 1 of the 3 pages.
Is there a correct way to do that? Maybe a Show/Hide property or must I change the setNavigationMode of the sherlockActionBar?
Thanks and sorry for my poor English
You can easily hide the DropDown list by using this line of code :
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
Then you can implement an OnPageChangeListener to be notify when the user scrolls.
Related
I want to design a layout similar to the images where user selects one item in each step (drink,sauce...) user advances next step (and its displayed in stepper). user can also swipe(in red area) or click one of "1,2,3,4,5" pages to change page.
I searched how to do it with recyclerview but couldn't find a solution. What layout do i need to use for such case. just need to know how to achieve similar designs. I don't need code or xml for solution just an explanation will be enough.
Thanks for helping.
You should use TabLayout and ViewPager. You have to add TabLayout and ViewPager. Than, your TabLayout should have different TabLayout inside of that ViewPager.
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/
In my app, users can send an icon/gift to other users. I want to show a DialogFragment popup that includes paging of available icons.
For example, I have a total of 15 icons to display. I want to show 6 icons per page, which means i should have 3 "pages" to swipe through horizontally.
I tried using a FragmentPagerAdapter and RecyclerView with GridLayout for the icons. But it's not really working like i want it.
How can this be implemented using a PagerAdapter without any fragments?
If you dont want to use fragments then try with a normal activity with a dialog theme. eg; <activity android:name="your_activity_name" android:theme="#android:style/Theme.Dialog" />
Create a DialogFragment with ViewPager and Pager Indicator in it (as per your design).
Add a PagerAdapter for the ViewPager.
Create a layout and add the RecyclerView in it.
Now use that layout created in 3rd Step in PagerAdapter and inside PagerAdapter, set Adapter for recyclerview with GridLayoutManager and Horizontal Orientation and show the 6 items from your list.
You can use three pages each containing a RecyclerView, each page is a custom view instead of a fragment.
But you still have to use the ViewPager to navigate through the pages
I am working with android fragments.I have a main activity and 3 fragments (tab1,tab2,tab3) in my app.Each fragment contains its own custom listview using base adapter.I want implement action bar search view in each fragment.I can do it using edittext search actions using setting editttext in each layout. But my question is is it possible to do it with actionbar searchview in each tab ?? If yes how can I detect which tab is currently selected or focused ?? and is it possible to do it with custom listview in fragment?? Please help me with some links or answer. Thanks in advance :)
Yes, the answer for all your questions its "yes".
You can use only one search box to filter all the listviews in all tabs / fragments. (I assume this is what you are trying to do)
TabHost has a method getCurrentTab() which returns the index of the tab that's in focus.
The content of the search bar (which is an EditText) you know now to which fragment to send. You can use this to filter the ListView.
I am trying to make an application that has the following design.
Login->Dashboard
Dashboard has a #navigationdrawer having a listview ,of which every item opens a fragment.
Dashboard has a view pager of two pages.
Page 1 : listview
Page2: search bar.
Till now this is in place.
Problem statement :
The #page2 is constant it has to appear on every fragment ,but #page1 changes for every fragment . Can someone help me achieve this.
I am not getting how to do it.
I think you should use search menu item in Dashboard's ActionBar instead of fragment and display it using viewpager. Check following link to make search interface.
http://developer.android.com/guide/topics/search/search-dialog.html