android-viewpager

Why my Android ActionBar doesn't update when it is explictily changed

醉酒当歌 提交于 2019-12-17 14:29:08
问题 I've seen questions on SO that related to these many times. So I've decided to post the reason why it happens and also the solution so that many SO users will get the benefit of the answer. For sometime now I've seen a reoccurring issue where I would change the ActionBar title and it would get ellipsized shorter than it should. Another symptom of this is having your title wrap when it shouldn't or just stay completely blank. When you change the the action bar buttons it wouldn't update

How to customize individual tabs? (changing background color, indicator color and text color)

空扰寡人 提交于 2019-12-17 11:46:19
问题 In this link : How do I apply a style programmatically? Kevin Grant gave a explaination to this question my problem with his code is the context part. To be precise : ctv = new CustomView(context, R.attr.tabStyleAttr); In this code it says : context cannot be resolved to a variable I want to apply specific style to tabs and that's why setting theme doesn't work for me. Any alternative to my problem is welcome too of course. I try to change the background color, indicator color and text color

How to snap RecyclerView items so that every X items would be considered like a single unit to snap to?

…衆ロ難τιáo~ 提交于 2019-12-17 10:38:11
问题 Background It's possible to snap a RecyclerView to its center using : LinearSnapHelper().attachToRecyclerView(recyclerView) Example: MainActivity.kt class MainActivity : AppCompatActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) val inflater = LayoutInflater.from(this) recyclerView.adapter = object : RecyclerView.Adapter<RecyclerView.ViewHolder>() { override fun onBindViewHolder(holder: RecyclerView

ViewPager with fragments - onPause(), onResume()?

对着背影说爱祢 提交于 2019-12-17 10:24:09
问题 When using ViewPager with fragments, our onPause , onResume methods are not called when moving between tabs. Is there any way we can figure out in the fragment when we're being made visible or being hidden? Unfortunately I have logic in onResume , onPause , like registering with location services, that never get stopped when switching tabs because onPause never gets called until one exits the whole app. 回答1: The ViewPager comes with the OnPageChangeListener interface. By setting some flags

App crash after activity has been killed in background

梦想与她 提交于 2019-12-17 09:57:30
问题 i have an issue with an app that use ViewPager for display fragment. All works fine until the app goes in background and be killed from OS. It seems that after restore i have 2 IncidentScreenFragment that handle events, one with a null presenter (MVP) that crash my app. My HomeActivity looks like: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) presenter.onViewCreated() initViews(savedInstanceState) } private fun

Error including Android-DirectionalViewPager .jar in Eclipse

冷暖自知 提交于 2019-12-17 09:32:50
问题 I am trying to implement vertical swiping in my app. (Its just like the swiping with ViewPager, but vertically). I found Jake Whartons library Android-DirectionalViewPager. It is a standalone .jar file which should be included in addition to the compatibility library. I included the file in my project. It is now under 'Referenced Libraries', just like the compatibility library. But the problem is, I cant even get the example, which is given with the library, to work. The debugger stops at

View Pager + ImageView +Pinch Zoom + Rotation

我们两清 提交于 2019-12-17 08:53:11
问题 I want to implement Pinch Zoom on Imageview, with in View Pager similar to Default Android Gallery. I have found multiple source over GitHub, But the zoom and sliding just work for only first image. What I have tried: 1.) TouchImageView 2.) PhotoView 3.) Android Touch Gallery All the above links works fine for single image view. But when it comes to Images in View pager, They have some glitches and only works fine for first image in the View Pager. When we scroll over to 3rd 4th image in view

how to disable viewpager adapter on touching specific views?

大兔子大兔子 提交于 2019-12-17 08:48:20
问题 I have a viewpager which switches between tabs when swiping left/right.In my second tab, i have some custom views which have listeners for pinching and dragging but when i try to pinch or drag, the viewpager starts to swipe the page. A solution comes to my mind is to disable swiping when touching those specific views and only swipe when touching outside those views.Is this possible? Updated: @Asok kindly provided the solution. But then updated the code which wouldnt work in my case so i post

View Pager in listview?

蹲街弑〆低调 提交于 2019-12-17 07:34:21
问题 I am using view pager in listview item. I want to show images in view pager but the lazy loading is not working with it. Please give me any solution. I have tried many lazy loading files but some are working. Some are holding the UI. The code which I'm using now is working good but not showing the images for the first time. I have to scroll down the listview then scroll up then only it is showing. I don't know what is the problem please give me some solution what I have to do? I am posting my

onClick on ViewPager not triggered

孤街醉人 提交于 2019-12-17 06:28:11
问题 I set a click listener on a ViewPager , but the onClick event is never called. I guess the touch event detection of the ViewPager is interfering, but I can't see how to solve it... Anybody could help? Thanks mViewPager.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // never called } }); 回答1: Indeed the viewpager is interfering. But you can override the methods of the viewpager to make it do what you want. You'll need to override the ViewGroup