Android的Viewpager EdgeEffect自定义颜色自定义、颜色、Android、Viewpager

2023-09-09 21:10:51 作者:青衫如故

我想定制我的应用程序的Viewpager的EdgeEffect。其目的是用自定义红色更换蓝色集成电路Overscroll EdgeEffect即。所以刚开始我编 overscroll_edge 和相应的overscroll_glow。然后,我把他们俩到我的应用程序的/ RES /绘制目录。此外,我复制的 EdgeEffect源文件到/ src目录/安卓/空间/我的应用程序的目录。我取得EdgeEffect唯一的变化是进口com.my.application.R而不是com.android.internal.R。

I am trying to customize the EdgeEffect in the Viewpager of my App. The aim was to replace the blue ics Overscroll EdgeEffect i.e. with a custom red one. So at first i edited overscroll_edge and the corresponding overscroll_glow. Then I put them both into the /res/drawable directory of my app. Additionally i copied the EdgeEffect Source File to the /src/android/widget/ directory of my app. The only change i made in EdgeEffect was to import com.my.application.R instead of com.android.internal.R.

但是Android就不会用我的自定义android.widget.EdgeEffect,而不是一个在Android系统,所以Viewpager EdgeEffect保持不断蓝色。我失去了一些东西?

But Android just won't use my custom android.widget.EdgeEffect instead of the one in Android System, so the Viewpager EdgeEffect stays constantly blue. Am I missing something?

推荐答案

您必须实施 ViewPager PagerAdapter FragmentstatePagerAdapter EdgeEffectCompat EdgeEffectCompatIcs EdgeEffect 在一个包你自己的应用程序(例如com.yourapp.viewpager)。只有所做的更改是调整进口和包名。复制和编辑资源文件水库的/可绘制您的应用程序和等瞧,它的工作的。

You have to implement ViewPager, PagerAdapter, FragmentstatePagerAdapter, EdgeEffectCompat, EdgeEffectCompatIcs and EdgeEffect in a package of your own app (for example com.yourapp.viewpager). Only changes made was adjusting the imports and packages names. Copy and edit resources files to res/drawable of your app and et voila, it work's.