IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Composants graphiques Android Discussion :

Problème avec WebView


Sujet :

Composants graphiques Android

  1. #1
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2011
    Messages : 3
    Points : 3
    Points
    3
    Par défaut Problème avec WebView
    Bonjour,

    J'ai un problème avec l'affichage de ma WebView : sa hauteur dépasse (parfois, souvent... à vrai dire aléatoirement!!) la hauteur de son contenu...

    En fait ma WebView n'ai pas scrollable, car elle est contenu dans une ScrollView avec d'autres composants.
    Pour être plus claire, dans mon Activity j'ai deux EditText, une ImageView, ma WebView, puis un troisième EditText (qui se retrouve donc aléatoirement distant de la WebView du dessus!)

    Dans mon Layout:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
     
    <ScrollView
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" >
     
    <TextView
    android:id="@+id/txtArticleTitre"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
    <TextView
    android:id="@+id/txtArticleDate"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" />
    <LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal" >
    <ImageView
            android:id="@+id/imgArticle"
            android:layout_width="320dip"
            android:layout_height="220dip"
            android:adjustViewBounds="true">
            </ImageView>
    </LinearLayout>
     
    <WebView
    android:id="@+id/wvArticle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >
    </WebView>
     
    </LinearLayout>
    </ScrollView>
    Dans mon Activity:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
     
    WebView wv = (WebView)findViewById(R.id.wvArticle);
    wv.setScrollContainer(false);
    WebSettings webSettings = wv.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setPluginsEnabled(true);
    webSettings.setBuiltInZoomControls(false);
    webSettings.setSupportZoom(false);
    String pageHtml = "......"; // String contenant mon code HTML pour ma WebView
    wv.loadDataWithBaseURL(null, pageHTML, "text/html", "UTF-8", null);
    J'attends un petit indice qui pourrait me donner une piste à explorer, car je désespère!! Ça fait plusieurs jours que je cherche en vain...
    Merci d'avance

  2. #2
    Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2011
    Messages : 3
    Points : 3
    Points
    3
    Par défaut
    Personne n'a rencontré ce problème auparavant...???!!

    Pour plus de précision, voici mon String pageHtml:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
     
    String pageHTML = "<HTML> " +
              "<HEAD>" +
              "<link rel=\"stylesheet\" href=\"css/all.css\"> " +
              "<link rel=\"stylesheet\" href=\"css/mdpi.css\" media=\"only screen and (-webkit-max-device-pixel-ratio:1.0) and (max-device-width:480px)\">" +
              "<link rel=\"stylesheet\" href=\"css/hdpi.css\" media=\"only screen and (-webkit-min-device-pixel-ratio:1.5)\">" +
              "<meta name=\"viewport\" content=\"user-scalable=no, width=device-width, target-densitydpi=device-dpi\">" +
              "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />" +
              "<TITLE>Android| "+title+"</TITLE>" +
              "<STYLE type=\"text/css\">" +
              "P { text-align : justify; font-size:16px;  }" +
              "BODY { height : 100%; width : auto;  }" +
              ".conteneur_liste {" +
              "max-width : "+mScreenWidth+"px;" +
              "position: relative;" +
              "float: left;" +
              "height: auto;" +
              "font-family:Arial, Helvetica, sans-serif;" +
              "font-size: 16px;" +
              "text-align: justify;" +
              "bottommargin: 0; " +
              "}" +
              ".conteneur_liste img {" +
              "width : "+(mScreenWidth-35)+"px;" +
              "position:relative;" +
              "float:left;" +
              "height:auto;" +
              "padding-left:5px;" +
              "padding-bottom:10px;" +
              "margin:0;" +
              "}" +
              ".auteur {" +
              "height:auto;" +
              "text-align:right;" +
              "color:black;" +
              "font-family:bold;" +
              "padding-bottom:10px;" +
              "}" +
              "</STYLE>"  +
              "<script type=\"text/javascript\">" +
              "var currentSize = 16;" +
              "var minSize = 12;" +
              "var maxSize = 24;" +
              "var h = 0;" +
              "function AgrandirTaille() {" +
              "currentSize += 2;" +
              "currentSize = (currentSize<minSize) ? minSize : ((currentSize>maxSize) ? maxSize : currentSize);" +
              "document.getElementById(\"content\").style.fontSize = currentSize+'px';" +
              "}" +
              "function ReduireTaille() {" +
              "currentSize = currentSize-2;" +
              "currentSize = (currentSize<minSize) ? minSize : ((currentSize>maxSize) ? maxSize : currentSize);" +
              "document.getElementById(\"content\").style.fontSize = currentSize+'px';" +
              "}" +
              "</script>" +
              "</HEAD>" +
              "<BODY>" +
              "<div class=\"conteneur_liste\">"+
              "<p id=\"content\">"+description+"</p>"+
              "<p class=\"auteur\">"+auteur+"</p>"+
              "</div>"+
              "</BODY>" +
              "</HTML>";

Discussions similaires

  1. Problème avec webview
    Par eric116 dans le forum Composants graphiques
    Réponses: 3
    Dernier message: 06/01/2011, 12h27
  2. VC++ Direct3D8, problème avec LPD3DXFONT et LPD3DTEXTURE8
    Par Magus (Dave) dans le forum DirectX
    Réponses: 3
    Dernier message: 03/08/2002, 11h10
  3. Problème avec le type 'Corba::Any_out'
    Par Steven dans le forum CORBA
    Réponses: 2
    Dernier message: 14/07/2002, 18h48
  4. Problème avec la mémoire virtuelle
    Par Anonymous dans le forum CORBA
    Réponses: 13
    Dernier message: 16/04/2002, 16h10

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo