Could this code cause webview to not "connect" to the xml’s center_horizontal?

Asked

Viewed 29 times

0

I have this code to upload a video to the webview , I had already made a post but I forgot to present the code .

 mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
            mWebView.loadUrl(Vid[0]);
            mWebView.setLayoutParams(new LinearLayout.LayoutParams(350, 350));
            mWebView.setWebChromeClient(new WebChromeClient());

my full xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:background="#f0f0f0"
    android:orientation="vertical"
    android:layout_gravity="center_horizontal"
    android:gravity="center_horizontal">
<ScrollView
    android:layout_width="fill_parent"
    android:layout_height="3000dp"
    >
    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="center_horizontal"
        >
        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:adjustViewBounds="true"
            android:cropToPadding="false"

            android:layout_gravity="center_horizontal"
            android:layout_alignParentTop="true"
            android:scaleType="fitXY"
            android:id="@+id/imgcabecalho"

            />
        <TextView
            android:id="@+id/tvinformacoes"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"



            android:textColor="#FFFFFF"
            android:textSize="12dp"
            android:textStyle="bold"
            android:background="#00BFFF"

            android:text="nome" />


        <TextView
        android:id="@+id/tvdescricao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"



        android:textColor="#333"
        android:textSize="12dp"
        android:textStyle="bold"
        android:text="nome" />



        <ImageView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
                android:layout_gravity="center_horizontal"
              android:id="@+id/img1"



               />

        <TextView
          android:id="@+id/tvdescricao2"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"


          android:textColor="#333"
          android:textSize="12dp"
          android:textStyle="bold"
          android:text=""

          />




           <ImageView
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"
               android:id="@+id/img2"
               android:layout_gravity="center_horizontal"


                />

        <TextView
           android:id="@+id/tvdescricao3"
           android:layout_width="wrap_content"
           android:layout_height="wrap_content"



           android:textColor="#333"
           android:textSize="12dp"
           android:textStyle="bold"
           android:text=""

          />



                    <ImageView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center_horizontal"
                        android:id="@+id/img3"



                   />

        <TextView
                    android:id="@+id/tvdescricao4"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"


                    android:textColor="#333"
                    android:textSize="12dp"
                    android:textStyle="bold"
                    android:text=""

                   />




                                                                       <ImageView
                                                                           android:layout_width="wrap_content"
                                                                           android:layout_height="wrap_content"
                                                                           android:layout_gravity="center_horizontal"
                                                                           android:id="@+id/img4"



                                                                           />


        <TextView
                                                                       android:id="@+id/tvdescricao5"
                                                                       android:layout_width="wrap_content"
                                                                       android:layout_height="wrap_content"

                                                                       android:textColor="#333"
                                                                       android:textSize="12dp"
                                                                       android:textStyle="bold"
                                                                       android:text=""

                                                                     />


                   <ImageView
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:layout_gravity="center_horizontal"
                       android:id="@+id/img5"



                        />


        <TextView
                   android:id="@+id/tvdescricao6"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"



                   android:textColor="#333"
                   android:textSize="12dp"
                   android:textStyle="bold"
                   android:text=""

                   />




                   <ImageView
                       android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
                       android:layout_gravity="center_horizontal"
                       android:id="@+id/img6"



                      />


        <TextView
                   android:id="@+id/tvdescricao7"
                   android:layout_width="wrap_content"
                   android:layout_height="wrap_content"

                   android:padding="10dp"
                   android:textColor="#333"
                   android:textSize="12dp"
                   android:textStyle="bold"
                   android:text=""
                    />

        <WebView
        android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:scaleType="fitXY"
            android:layout_gravity="center_horizontal"
        android:id="@+id/webView"


        android:background="#f0f0f0" />
        <WebView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_alignParentTop="true"
            android:scaleType="fitXY"
            android:layout_gravity="center_horizontal"
            android:id="@+id/webView2"


            android:background="#f0f0f0" />
        <WebView
            android:layout_width="match_parent"
            android:layout_gravity="center_horizontal"
            android:layout_height="match_parent"
            android:id="@+id/webView3"


            android:background="#f0f0f0" />
        <WebView
            android:layout_width="match_parent"
            android:layout_gravity="center_horizontal"
            android:layout_height="match_parent"

            android:id="@+id/webView4"


            android:background="#f0f0f0" />

        <WebView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_gravity="center_horizontal"
            android:id="@+id/webView5"

            android:background="#f0f0f0" />

    </LinearLayout>
    </ScrollView>


</RelativeLayout>

Code from the webview

 <WebView
            android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_alignParentTop="true"
                android:scaleType="fitXY"
                android:layout_gravity="center_horizontal"
            android:id="@+id/webView"


            android:background="#f0f0f0" />

Screenshot how the videos are showing in my app :inserir a descrição da imagem aqui

  • Wouldn’t it be better to edit the previous question @Tiagocoelho? http://answall.com/q/74361/10315

  • I will delete the previous question

  • @Tiagocoelho then erases the previous.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.