android-viewpager

How to add page margin on top for Vertical view pager?

一世执手 提交于 2019-12-24 04:08:31
问题 I am trying to implement vertical view pager like "Happn" app Here is my custom ViewPager class VerticalViewPager.java import android.content.Context; import android.support.v4.view.ViewPager; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; public class VerticalViewPager extends ViewPager { public VerticalViewPager(Context context) { super(context); init(); } public VerticalViewPager(Context context, AttributeSet attrs) { super(context, attrs);

Multiple ViewPagers in on Activity

≯℡__Kan透↙ 提交于 2019-12-24 04:08:11
问题 I am trying to implement more than one ViewPager in one activity and it is not really working. What's the best way to implement that. I am stuck!! This is The Activity import android.app.Activity; import android.os.Bundle; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.widget.Button; import com.viewpagerindicator.CirclePageIndicator; public class NewWorkoutActivity extends Activity{ ViewPager corePager; ViewPager timePager; ViewPager

Android - How to handle orientation of FragmentActivity?

做~自己de王妃 提交于 2019-12-24 04:01:36
问题 I am currently using the Sherlock package and the view indicator package in my application to create a view pager with the titles at the top and then the action bar over that. For the most part it works OK however I have noticed that invalidateOptionsMenu() stops working after a screen orientation change. When my app loads it works fine until I rotate the device to landscape mode, from then on the invalidateOptionsMenu() call never invokes the onCreateOptionsMenu(Menu menu) method. It's a

Navigation Drawer + ViewPager + Fragments, ViewPager doesn't destroy nested fragments

情到浓时终转凉″ 提交于 2019-12-24 03:43:38
问题 My app has Navigation Drawer with two items: a ViewPager (inside a Fragment) and SupportMapFragment. ViewPager use a FragmentStatePagerAdapter and getItem(int position) return two Fragments. When I open navigation drawer and I select " item 1 " (SupportMapFragment), the other Fragment (ViewPager is inside of this) execute onDestroy() method but this method doesn't destroy the Fragments created by the adapter so when I select " item 0 " again , my app create the ViewPager with its two items

Android ViewPager + Fragments with dynamic ListViews

南楼画角 提交于 2019-12-24 03:07:27
问题 In my app I have activity with tabs (let's say 10 tabs). Each tab page contains Fragment with ListView (data displayed in this ListView is loaded dynamically from my server). I use ViewPager to display these pages. I don't want to keep all the Fragments in memory, so I decided to use FragmentStatePagerAdapter (My adapter class extends these class). Let's say 3rd tab is selected. Then, when I go for example to the first tab, Fragment for this tab should be created from scratch (that's fine, it

Using ViewPager with Tabs without actionBar

与世无争的帅哥 提交于 2019-12-24 01:53:58
问题 I am using the google example called EffectiveNavigation to create a ViewPager with tabs. The problem is that in the manifest, for my main activity, I have set android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" So that my app has no actionBar. Therefore I am getting a NullPointerException at final ActionBar actionBar = getActionBar();//null from getActionBar() actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);//NullPointerException Now, all I want is to be able to

ActionBar with ViewPager - clicking partially visible tab crashes the app

谁说我不能喝 提交于 2019-12-24 00:17:42
问题 I'm using a ViewPager to display 4 different fragments. I use the action bar to display the tabs for the navigation. It looks like that: My problem is that initially 3 of the tabs are fully visible and the last one is partially visible. Clicking on any of the first 3 tabs is ok but when I click on the last one, the app crashes: 09-06 13:35:01.825: E/AndroidRuntime(6676): FATAL EXCEPTION: main 09-06 13:35:01.825: E/AndroidRuntime(6676): java.lang.IllegalStateException: Content view not yet

Viewpager in Android

梦想的初衷 提交于 2019-12-23 23:30:15
问题 How could i create ViewPager in both direction . Is it possible ? If it possible how could i implement it. I have created viewpager in single direction using the below code: private void initialisePaging() { List<Fragment> fragments = new Vector<Fragment>(); fragments.add(Fragment.instantiate(this, Fragment0.class.getName())); fragments.add(Fragment.instantiate(this, Fragment1.class.getName())); fragments.add(Fragment.instantiate(this, Fragment2.class.getName())); this.mPagerAdapter = new

setCurrentItem of nested viewpager

浪尽此生 提交于 2019-12-23 23:27:49
问题 I have a ViewPager nested in a fragment, and when the device changes orientation I'd like to save and restore which page the ViewPager was on. I'm currently doing this: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mViewPager = (ViewPager) inflater.inflate(R.layout.activity_albumpicker, container, false); // Create the adapter that will return a fragment for each of the three // primary sections of the activity.

Animate Floating Action Button on ViewPager scroll

混江龙づ霸主 提交于 2019-12-23 17:36:47
问题 I have AppBarLayout, ViewPager below it and a Floating Action Button in one Activity. I want to animate the FAB when the ViewPager is scrolled. Have a look at the below screens. When Tab1 is the current tab then the FAB should be in the bottom-right corner. When Tab2 is the current tab then the FAB should be in the bottom-center area. When Tab3 is the current tab then the FAB should move back to bottom-right corner. When Tab4 is the current tab then the FAB should get anchored to ImageView4