我有一个应用程序左侧有SlidingPaneLayout
(默认隐藏)和屏幕可见部分的主要布局。 UI元素,例如TextView
s,图标(使用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));
但是我还是不知道这个的原因。