Android滚动视图去除蓝色光芒

28
当您在Android上使用ScrollView滚动时,它会在您滚动的方向上生成一个蓝色光。我该如何移除这个蓝色光?
我的清单文件:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/sobreScrollView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="@android:color/transparent"
android:scrollingCache="false" 
android:fadingEdge="none"
android:fadingEdgeLength="0dp"
android:scrollbars="none"
android:scrollbarStyle="insideOverlay"  
    >    

    <LinearLayout
        android:id="@+id/contentSobre"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:orientation="vertical" >

Java源代码:

package com.my.app.section;
import android.content.Context;
import android.util.AttributeSet; 
import com.my.app.BaseSection; 
import com.my.app.R;

public class SobreSection extends BaseSection {

public SobreSection(Context context, AttributeSet attrs, int defStyle) {
    super(context, attrs, defStyle);
}

public SobreSection(Context context, AttributeSet attrs) {
    super(context, attrs);
}

public SobreSection(Context context) {
    super(context);
}

@Override
protected void onFinishInflate() {
    // TODO Auto-generated method stub
    super.onFinishInflate();

    findViewById(R.id.sobreScrollView).setVerticalFadingEdgeEnabled(false);
    findViewById(R.id.sobreScrollView).setVerticalScrollBarEnabled(false);

}
  }

请更准确地描述您的问题,您是想要蓝色叠加层还是不想要? - bricklore
当我滚动scrollview到末尾时,我不想看到蓝色的光。 - Nagi
2个回答

90

在你的 layout.xml 中的 ScrollView 中尝试添加以下内容:

android:overScrollMode="never"  

或者将下面的代码添加到您的代码中:

findViewById(R.id.sobreScrollView).setOverScrollMode(ScrollView.OVER_SCROLL_NEV‌​ER);

在此行有多个标记
  • OVER_SCROLL_NEVER 无法解析或不是一个字段
  • View 无法解析为变量
- Nagi
抱歉,它在 ScrollView 类中,所以应该是:ScrollView.OVER_SCROLL_NEVER :) - bricklore
1
这个(至少是XML版本)同样适用于viewPager - Timmiej93

11

将这一行添加到你的ScrollView定义中:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/sobreScrollView"
    ...
    android:overScrollMode="never"> 

返回错误:在“android”包中找不到属性“overScrollMode”的资源标识符。 - Nagi
它是在API级别9中添加的。因此,您需要使用比您当前使用的SDK(9或更高版本)更新的版本。 - nmw

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接