小编Sae*_*esh的帖子

以编程方式滑动时更改 ViewPager2 滚动速度

我知道有办法改变ViewPager编程幻灯片的动画持续时间(这里)。

但它不工作 ViewPager2

我试过这个:

try {
        final Field scrollerField = ViewPager2.class.getDeclaredField("mScroller");
        scrollerField.setAccessible(true);
        final ResizeViewPagerScroller scroller = new ResizeViewPagerScroller(getContext());
        scrollerField.set(mViewPager, scroller);
    } catch (Exception e) {
        e.printStackTrace();
    }
Run Code Online (Sandbox Code Playgroud)

IDE 给我关于“mScroller”的警告:

无法解析字段“mScroller”

如果我们运行此代码将无法工作并在下面给我们错误:

No field mScroller in class Landroidx/viewpager2/widget/ViewPager2; (declaration of 'androidx.viewpager2.widget.ViewPager2' appears in /data/app/{packagename}-RWJhF9Gydojax8zFyFwFXg==/base.apk)
Run Code Online (Sandbox Code Playgroud)

那么我们如何才能实现这个功能呢?

android androidx android-viewpager2

20
推荐指数
2
解决办法
6729
查看次数

windowLightNavigationBar not working on Android 10 (Q)

I'm trying to make Navigation Bar Light With dark Dots on it So I made style-v27.xml with windowLightNavigationBar = true :

    <item name="android:windowLightNavigationBar">true</item>
    <item name="android:navigationBarColor">@android:color/white</item>
Run Code Online (Sandbox Code Playgroud)

this feature is available in Api Level 27+ AND:

  • it works fine on api 27 (android 8.1) - emulator
  • it works fine on api 28 (android 9) - emulator
  • it's NOT working on api 29 (android 10) - emulator

On Android 10 dot remains White And Background is Also White!:

在此输入图像描述

顺便说一下,我的目标是 Api 29。我已经在“模拟器”上进行了测试。我尚未访问真正的 Android 10 …

android android-10.0

5
推荐指数
1
解决办法
1170
查看次数

WooCommerce REST API - 如何获取产品调整大小的图片网址?

wordpress 中的所有图片都会自动调整大小并保存在上传文件夹中,如下所示:

sample_product_image-100x100.png
sample_product_image-150x150.png
sample_product_image-180x113.png
sample_product_image-300x189.png
...
sample_product_image-555x349.png
sample_product_image-600x378.png
sample_product_image.png (original large file)
Run Code Online (Sandbox Code Playgroud)

为了更快地加载,我需要在rest api中使用较小尺寸的产品图像,如下所示:

sample_product_image-300x189.png
Run Code Online (Sandbox Code Playgroud)

但是 woocommerce rest api 只是向我发送原始最大文件(sample_product_image.png):

"images": [
            {
                "id": 7291,
                "date_created": "2018-06-12T03:17:03",
                "date_created_gmt": "2018-06-11T13:47:03",
                "date_modified": "2018-06-12T03:17:03",
                "date_modified_gmt": "2018-06-11T13:47:03",
                "src": "http://example.com/wp-content/uploads/2018/06/sample_product_image.png",
                "name": "sample_product_image",
                "alt": "",
                "position": 0
            },
Run Code Online (Sandbox Code Playgroud)

如何在 wc rest api 中获得较小的图像 url?

顺便说一句,我发现这个wordpress rest api插件不适用于 woocommerce。

woocommerce-rest-api

1
推荐指数
1
解决办法
2510
查看次数