android-viewpager

How can i set a tag for viewpager fragments?

拜拜、爱过 提交于 2019-12-18 14:48:37
问题 I,m using slidingTabLayout with 4 tabs and a viewpager and 4 fragment class for every tab. i need to reload one of my fragments (first tab) in my project when user click some button, and for this i need to have a tag for that fragment my question is : how can i set a tag for one of viewpagers fragment??? My MainActivity tab and viewpager codes: public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { Toolbar toolbar; ViewPager pager;

Is there a way to disable fading that a viewPager has scroll to edges?

為{幸葍}努か 提交于 2019-12-18 13:55:08
问题 Scrollable views such as the ListView have a fade blue effect along the edges where there is no content and scroll to the end. How can I close the effect? at listview i can use : setHorizontalFadingEdgeEnabled(false); android:fadingEdge="none" android:requiresFadingEdge="none" but at the viewPager not useful,can give me some advice 回答1: I have a solution: android:overScrollMode="never" Now everything is OK. I found the solution here. 回答2: pengwang's answer is good,but it is above android 10

Swiping images (not layouts) with viewpager

点点圈 提交于 2019-12-18 13:37:55
问题 What my code does: Here's my code which for viewpager that swipes between xml layouts (named left.xml, right.xml and center.xml). What I want it to do I want to swipe between images (stored in the drawable folder). When I replace R.layout.xml with R.drawable.image, my app crashes down. Can anybody help me figure it out? public class MainActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity

Gridview - Click image to view image in Viewpager

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 13:33:14
问题 This is a gridview that get image from json. and it works fine. I want to click image in this gridview to show full image and can slide it. I find the solution of this problem is used Viewpager. how can I click image in gridview to show image and can slid? you can read this code more easier. http://pastebin.com/Q8Ljt9yL public class MainActivity extends Activity { public static final int DIALOG_DOWNLOAD_JSON_PROGRESS = 0; private ProgressDialog mProgressDialog; ArrayList<HashMap<String,

How do I pass a variable through a FragmentPagerAdapter to a Fragment?

可紊 提交于 2019-12-18 13:13:11
问题 I'm an android beginner, trying to learn, and this is my first question, so please excuse me if the question is too simple and please tell me if I'm using the forum incorrectly. I have a FragmentActivity using a layout that includes a viewpager; the activity creates an instance of MyFragmentPagerAdapter, which creates several instances of MyFragment. All are support.v4 versions. I'm trying to find a way to pass an integer value (representing a selection the user has made previously, which

Android ViewPager and ListViews

与世无争的帅哥 提交于 2019-12-18 13:01:43
问题 I'm relatively new to Android development and development overall. I'm having trouble grasping the syntax/process for ViewPager. I have several ListViews that I want to implement into a ViewPager. I've got the compatibility pack loaded and everything. But I haven't seen any complete examples of how to do this. I learn best by looking at examples. If someone can post an examples of any projects you've implemented this sort of thing in, please let me know. The issue is that I get a Null Pointer

How to change activity with left-right swipe

徘徊边缘 提交于 2019-12-18 12:54:17
问题 How to change activity with left-right swipe? I did not find the manual anywhere. Example: 回答1: Regarding your first link, its called ViewPager . Follow one of the awesome tutorial it will definitely help. 回答2: You're looking for a ViewPager. See this part of the documentation for details on sliding screens with it. 来源: https://stackoverflow.com/questions/14965124/how-to-change-activity-with-left-right-swipe

Android TabLayout custom indicator width

余生长醉 提交于 2019-12-18 12:00:31
问题 I want to reduce width of indicator - for example, make it's width not whole tab width, but 1/2 of tab width. That's all I need to do, so I don't want to download some custom library and search where I can do this. Is it a way to do this or I should write such view by myself? 回答1: Try this. public void setIndicator (TabLayout tabs,int leftDip,int rightDip){ Class<?> tabLayout = tabs.getClass(); Field tabStrip = null; try { tabStrip = tabLayout.getDeclaredField("mTabStrip"); } catch

FragmentTabHost - No tab known for tag null

北城以北 提交于 2019-12-18 11:47:43
问题 Few days ago I implemented TabHostFramgent in a Fragment with a NavigationDrawer , and I faced with a problem that is the following error : java.lang.IllegalStateException: No tab known for tag null The thing is that all works perfectly since my first item list of my NavigationDrawer is my TabHostFragment , so it works perfect, but the problem is when I go in example to the second item and then I want to go back to the first item, every time that I try so it crashes. I was searching

ViewPager + Adapter in Fragment => laggy swiping

故事扮演 提交于 2019-12-18 11:34:51
问题 I have a ViewPager with some fragments. Each fragment has a ListView in a SlidingDrawer (=invisible before swiping) with an ArrayAdapter . Adapter is set on onCreateView() , that slows down swiping, because 30 list items have to load each time I swipe, because new fragments are being created. My Question is, whether it is possible to set the adapter after swiping when it ViewPager is idle? Or is there a better way? The List needs to be already loaded when the SlidingDrawer is expanded. 回答1: