2017-08-02 9 views
1

:hover疑似セレクタとcursorプロパティの両方を使用して、いくつかのcssホバースタイルを持つウェブページがあります。このウェブページを、マウス(Chromebookなど)を搭載したAndroid搭載端末の埋め込みWebViewに読み込むと、CSSのホバー規則が認識されません。カーソルは常に同じで、ホバーの強調表示は決してトリガーしません。この動作を有効にする方法はありますか?Android Webviewでホバー動作が有効にならない

のJava:

public class MainActivity extends AppCompatActivity { 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     WebView webview = (WebView) findViewById(R.id.webview); 
     webview.loadUrl("http://localserver/test.html"); 
    } 
} 

XML:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="world.of.testapp.MainActivity"> 

    <WebView 
     android:id="@+id/webview" 
     android:layout_width="368dp" 
     android:layout_height="495dp" 
     tools:layout_editor_absoluteX="8dp" 
     tools:layout_editor_absoluteY="8dp" /> 
</android.support.constraint.ConstraintLayout> 

test.htmlという:

<html> 
    <head> 
    <style> 
     #a:hover { 
     color: red; 
     } 

     #b { 
     cursor: pointer; 
     } 
    </style> 
    </head> 
    <body> 
    <div id="a">HELLO</div> 
    <div id="b">WORLD</div> 
    </body> 
</head> 

答えて

関連する問題