UI 不在某些设备上更新
UI not updating on some devices
我有一个应用程序,其左侧有 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
等方法进行更新。问题是,在某些设备上(最后一次出现在 Samsung J3,Android 5.1.1)上,这些方法不起作用(它适用于数以千计的其他设备)。单击元素,但内容未更新(例如,当用户触摸图标时更改图标)。仅在显示 SlidingPane
(从左侧滑动)或恢复 activity 后更新。有人知道什么可以阻止应用程序更新这些元素吗?它在新更新之前运行良好。带来的新更新:ConstraintLayout
、png 背景、vector
个图标。
谢谢。
找到问题了。将淡入淡出颜色从半透明设置为透明解决了这个问题。
this.setSliderFadeColor(ContextCompat.getColor(context, android.R.color.transparent));
不过我还是不知道这是什么原因。
我有一个应用程序,其左侧有 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
等方法进行更新。问题是,在某些设备上(最后一次出现在 Samsung J3,Android 5.1.1)上,这些方法不起作用(它适用于数以千计的其他设备)。单击元素,但内容未更新(例如,当用户触摸图标时更改图标)。仅在显示 SlidingPane
(从左侧滑动)或恢复 activity 后更新。有人知道什么可以阻止应用程序更新这些元素吗?它在新更新之前运行良好。带来的新更新:ConstraintLayout
、png 背景、vector
个图标。
谢谢。
找到问题了。将淡入淡出颜色从半透明设置为透明解决了这个问题。
this.setSliderFadeColor(ContextCompat.getColor(context, android.R.color.transparent));
不过我还是不知道这是什么原因。