Android的Viewpager EdgeEffect自定义颜色 [英] Android Viewpager EdgeEffect custom Color

查看:518
本文介绍了Android的Viewpager EdgeEffect自定义颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想定制我的应用程序的Viewpager的EdgeEffect。其目的是用自定义红色更换蓝色集成电路Overscroll EdgeEffect即。所以刚开始我编<一个href="https://github.com/android/platform_frameworks_base/blob/master/core/res/res/drawable-xhdpi/overscroll_edge.png"相对=nofollow> overscroll_edge 和相应的overscroll_glow。然后,我把他们俩到我的应用程序的/ RES /绘制目录。此外,我复制的<一个href="https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/EdgeEffect.java"相对=nofollow> 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.

这篇关于Android的Viewpager EdgeEffect自定义颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆