2013-01-07 37 views
20

當您使用滾動視圖在Android上滾動時,它會生成一個藍色光指示您滾動的方向。如何移除藍色光?Android滾動視圖移除藍色光

我的清單:

<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); 

} 
    } 
+0

請描述你的問題更準確,做你想做的藍色覆蓋,或者不想要它? – bricklore

+0

我不想藍光當我搖通過滾動型月底 – Nagi

回答

67

嘗試在layout.xml添加以下內容到滾動型:

android:overScrollMode="never" 

或添加到您的代碼:

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

在該行返回多個標記 \t - OVER_SCROLL_NEVER不能得到解決或無法在現場 \t - 查看不能被解析爲一個變量 – Nagi

+0

哎呀,SRY它在ScrollView類中,所以它是:'ScrollView.OVER_SCROLL_NEVER' :) – bricklore

+1

這個(至少是XML版本)也適用於'viewPager'! – Timmiej93

9

這個額外的行添加到您的ScrollView定義:

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

返回錯誤:在'android'包中找不到屬性'overScrollMode'的資源標識符 – Nagi

+0

它是在API級別9中添加的。因此,您需要使用比當前使用的更高版本的SDK(9或更高版本) 。 – nmw