大家
我在网页浏览中遇到一个奇怪的问题。当我使用api level 19模拟器的所有行 即使我展开了所有"段落(#1600;附近的1600行),但显示了这些行 当我使用api level 24或25时,部分显示(1200行)。
<!DOCTYPE html>
<html>
<head>
<title>title</title>
<style>
div
{
text-align:justify;
text-justify:inter-word;
}
</style>
<link rel="stylesheet" media="all" title="style de la page" href="afficher_cacher_div.css" />
<script type="text/javascript" src="js/visibilite.js"></script>
<script type="text/javascript" src="afficher_cacher_div.js"></script>
<script>
function visibilite(thingId)
{
var targetElement;
targetElement = document.getElementById(thingId) ;
if (targetElement.style.display == "none")
{
targetElement.style.display = "" ;
} else {
targetElement.style.display = "none" ;
}
}
</script>
</head>
<body>
<a href="javascript:visibilite('divid');"> <u> Solution: </u></a>
<div id="divid" style="display:none;">
<br> <br>
<a href="javascript:visibilite('divid2');"> <u> part1 </u></a>
<div id="divid2" style="display:none;">
<br> <br>
<u> part 1(important): </u>
<br> <br>
nearby 900 lines of codes
<u>part 1(important):</u>
</div>
<br>
<br>
<a href="javascript:visibilite('divid4');"> <u> subpart 2: <br>
<br> (Display/Hide) </u></a>
<div id="divid4" style="display:none;">
<br>
<br>
<u>subpart 2:</u>
<br>
<br>
400 lines of codes
<br><br>
<u>Fin de la subpart 2.</u>
</div>
<br>
<br>
<br>
<br>
<a href="javascript:visibilite('divid5');"> <u> subpart 3: <br>
<br> (Display/Hide) </u></a>
<div id="divid5" style="display:none;">
<br>
<br>
<u>subpart 3:</u>
nearby 300 lines of codes
<br><br>
<u>Fin de la subpart 3.</u>
</div>
<script type="text/javascript">
//<!--
afficher_cacher('texte');
//-->
</script>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:scrollbarStyle="insideOverlay" android:background="@drawable/gradient9" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="720dp">
<View
android:id="@+id/View1"
android:layout_width="fill_parent"
android:layout_height="10dp"
android:layout_below="@+id/adView"
android:background="#00000000" />
<View
android:layout_width="fill_parent"
android:layout_height="15dp"
android:layout_below="@+id/View1"
android:background="#FF00FFDD" />
<TextView
android:id="@+id/textView1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="24dp"
android:text="@string/activity_main_submenu2_button3"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="20dip" />
<WebView
android:id="@+id/editText2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:layout_marginTop="93dp"
android:ems="20"
android:scrollbarStyle="insideOverlay"
android:scrollbars="horizontal|vertical" />
<Button
android:id="@+id/button1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/editText2"
android:layout_marginTop="20dp"
android:text="@string/Autre_exercice_button" />
<Button
android:id="@+id/button2"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/button1"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp"
android:text="@string/activity_main_submenu2_title" />
<Button
android:id="@+id/button3"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button2"
android:layout_below="@+id/button2"
android:layout_marginTop="10dp"
android:text="@string/activity_main_title" />
<Button
android:id="@+id/button4"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/button3"
android:layout_below="@+id/button3"
android:layout_marginTop="10dp"
android:text="@string/button_quit" />
<TextView
android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="@string/activity_main_submenu2_title"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="20dip" />
</RelativeLayout>
</ScrollView>
function visibilite(id) {
var divs = document.getElementsByTagName('div');
for(var no=0;no<divs.length;no++){
if(divs[ no].className=='divs'){ // on cible les divs dont la class est 'divs'
divs[ no].style.display = "none"; // on les masque tous
}
}
document.getElementById(id).style.display = "block"; // on affiche le div appelé
}
java(只是wiebview的调用)
webView=(WebView)findViewById(R.id.editText2);
webView.getSettings().setJavaScriptEnabled(true);
webView.setWebViewClient(new MyWebViewClient());
webView.setVerticalScrollBarEnabled(true);
webView.setHorizontalScrollBarEnabled(true);
if (EXOnumero == 1)
{ webView.loadUrl("file:///exo01x03x01.html");}
提前感谢您的帮助。