Android setHorizo​​ntalFadingEdgeEnabled 不适用于三星

标签 android scrollview samsung-mobile fading samsung-touchwiz

我有几个三星设备(GT-I9192/4.2.2、GT-I9295/4.2.2 等)用于测试目的,所有这些设备都不会显示 HorisontalScrollView 的渐变边缘。所有其他智能手机,如 HTC、摩托罗拉、魅族等(主要是 aos 4.x,有几个是 2.3.5)很好地显示了渐变边缘。
因为在 api14 中添加了新属性 android:requiresFadingEdge 它没有替代代码(至少我没有找到它)我使用以下布局(此滚动用于选项卡滚动):

<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/tabs_horisontal_scroll_view"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@color/white"
    android:fadingEdge="horizontal"
    android:fadingEdgeLength="32dp"
    android:fillViewport="true"
    android:layerType="software" //was thinking it might help but it doesn't
    android:requiresFadingEdge="horizontal"
    android:scrollbarAlwaysDrawHorizontalTrack="true"
    android:scrollbars="none" />

就像我说过的,在任何智能手机上一切正常,但在三星手机上却不行。实际上,三星设备确实绘制了 fadingEdge,它在所有三星设备上看起来都一样,但看起来最大宽度为 2-3px。所以我注意到它绘制了它而不是 32dp 并且它忽略了有关 FadingEdge 设置的所有内容。可能唯一的关闭是工作正常。
那么可能是什么问题?

最佳答案

尝试使用 android:overScrollMode 属性。

只需添加

android:overScrollMode="always"

到您的 Horizo​​ntalScrollView

android:overScrollMode can have three values: "always", "never", "ifContentScrolls".

关于Android setHorizo​​ntalFadingEdgeEnabled 不适用于三星,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21292569/

相关文章:

android - 通过 Facebook android API 发布表示成功,但在 Facebook 网站上找不到

iphone - UIScrollView 中 UITableView 的内容大小问题

android - adb 无法识别 Samsung Note II 和 Note 10.1

java - Android 在 4.4.2 samsung 上不释放内存

Android:强制 480x320 屏幕分辨率

android - btn.performClick() 无法模拟对象,但 Activity 可以调用该函数

Android - 如何正确执行后台线程?

java - ScrollView 不与 LinearLayout 一起使用,打开键盘时 View 有重量?

c# - 操纵事件和平移模式

android - libgdx:SpriteBatch,Samsung Android 设备上的 fragment 着色器工作不正确