简体   繁体   English

UI 未在某些设备上更新

[英]UI not updating on some devices

I have an app which has SlidingPaneLayout on the left (hidden by default) and main layout on the visible part of the screen.我有一个应用程序,它的左侧有SlidingPaneLayout (默认隐藏),主布局位于屏幕的可见部分。 UI elements, such as TextView s, icons (using vectors ) and SeekBar are displayed in this main layout and are updated based on user interactions. UI 元素,例如TextView 、图标(使用vectors )和SeekBar显示在此主布局中,并根据用户交互进行更新。 Layout is created using ConstraintLayout .布局是使用ConstraintLayout创建的。

<com....SlidingPaneLayout
    layout_width="match_parent"
    layout_height="match_parent">

    <android.support.constraint.ConstraintLayout
        android:id="@+id/left_panel"
        layout_width="200dp"
        layout_height="match_parent">
        ...
    </android.support.constraint.ConstraintLayout>

    <android.support.constraint.ConstraintLayout
        android:id="@+id/main_layout"
        layout_width="match_parent"
        layout_height="match_parent">
       ...
        <ImageView
        android:id="@+id/iv_example_icon"
        app:srcCompat="@drawable/ic_icon" />
       ...
    </android.support.constraint.ConstraintLayout>

</com....SlidingPaneLayout>

There's nothing strange in this layout.这种布局没有什么奇怪的。 Components are updating using methods like setText , setImageResource etc, called from the main thread.组件正在使用从主线程调用的setTextsetImageResource等方法进行更新。 The problem is, on some devices (last occurence on Samsung J3, Android 5.1.1), these methods are not working (it works on thousands of other devices).问题是,在某些设备上(最后一次出现在三星 J3、Android 5.1.1)上,这些方法不起作用(它适用于数千种其他设备)。 Element is clicked, but content is not updated (eg changing icon when user touches the icon).单击元素,但不更新内容(例如,当用户触摸图标时更改图标)。 It is updated only after SlidingPane is displayed (swiped from the left), or activity is resumed.它仅在显示SlidingPane (从左侧滑动)或恢复活动后更新。 Does anybody know what can prevent app from updating those elements?有谁知道什么可以阻止应用程序更新这些元素? It worked well before new update.它在新更新之前运行良好。 New update brought: ConstraintLayout , png background, vector icons.带来了新的更新: ConstraintLayout 、png 背景、 vector图标。

Thanks.谢谢。

Found out the problem.发现问题了。 Setting fade color from semi-transparent to transparent solved the issue.将淡入淡出颜色从半透明设置为透明解决了这个问题。

this.setSliderFadeColor(ContextCompat.getColor(context, android.R.color.transparent));

However I still do not know reason of this.但是我仍然不知道这是什么原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM