[英]UI not updating on some devices
我有一个应用程序,它的左侧有SlidingPaneLayout
(默认隐藏),主布局位于屏幕的可见部分。 UI 元素,例如TextView
、图标(使用vectors
)和SeekBar
显示在此主布局中,并根据用户交互进行更新。 布局是使用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>
这种布局没有什么奇怪的。 组件正在使用从主线程调用的setText
、 setImageResource
等方法进行更新。 问题是,在某些设备上(最后一次出现在三星 J3、Android 5.1.1)上,这些方法不起作用(它适用于数千种其他设备)。 单击元素,但不更新内容(例如,当用户触摸图标时更改图标)。 它仅在显示SlidingPane
(从左侧滑动)或恢复活动后更新。 有谁知道什么可以阻止应用程序更新这些元素? 它在新更新之前运行良好。 带来了新的更新: ConstraintLayout
、png 背景、 vector
图标。
谢谢。
发现问题了。 将淡入淡出颜色从半透明设置为透明解决了这个问题。
this.setSliderFadeColor(ContextCompat.getColor(context, android.R.color.transparent));
但是我仍然不知道这是什么原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.