【问题标题】:Fading Edge on Android WebView doesn't load - unless I'm missing something?Android WebView 上的 Fading Edge 无法加载 - 除非我遗漏了什么?
【发布时间】:2013-09-14 08:59:52
【问题描述】:

我有一个活动,它基本上只是一个加载一些内联 HTML 的 WebView,当用户滚动时,我希望边缘消失。我知道这并不复杂,而且我用 ListViews 等处理了一堆其他活动,但我似乎无法弄清楚这一点。

这是活动的 XML:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollview"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="5dp"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="5dp"
    android:requiresFadingEdge="vertical"
    android:scrollbarStyle="outsideOverlay"
    android:scrollbars="vertical" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <WebView
            android:id="@+id/browser"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />
    </RelativeLayout>

</ScrollView>

如果有人能指出我正确的方向,我将不胜感激。我对所有(建设性的)想法持开放态度。

哦,我现在也以编程方式设置了((ScrollView)findViewById(R.id.scrollview)).setVerticalFadingEdgeEnabled(true);

【问题讨论】:

    标签: android android-webview scrollview android-scrollview


    【解决方案1】:

    奇怪,但是,这就是解决我的问题的方法:

    <?xml version="1.0" encoding="utf-8"?>
    <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/scrollview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/transparent"
        android:orientation="vertical"
        android:paddingBottom="5dp"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="5dp"
        android:scrollbarStyle="outsideOverlay"
        android:scrollbars="vertical" >
    
        <WebView
            android:id="@+id/browser"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/transparent" />
    
    </ScrollView>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多