Webview does not want to go downtown

Asked

Viewed 56 times

0

Boa I have a Webview that does not want to go to the center of my app

I leave here the example inserir a descrição da imagem aqui

In my xml :

 <WebView
            android:layout_width="wrap_content"
            android:layout_height="0dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/webView2"


            android:background="#f0f0f0" />

my 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="fill_parent"
        android:layout_height="0dp"
            android:layout_gravity="center_horizontal"
        android:id="@+id/webView"


        android:background="#f0f0f0" />
        <WebView
            android:layout_width="fill_parent"
            android:layout_height="0dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/webView2"


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


            android:background="#f0f0f0" />
        <WebView
            android:layout_width="350dp"
            android:layout_gravity="center_horizontal"
            android:layout_height="0dp"

            android:id="@+id/webView4"


            android:background="#f0f0f0" />

        <WebView
            android:layout_width="350dp"
            android:layout_height="0dp"
            android:layout_gravity="center_horizontal"
            android:id="@+id/webView5"

            android:background="#f0f0f0" />

    </LinearLayout>
    </ScrollView>

Can anyone tell me why ?

  • Post your full layout XML please

  • It would be interesting to pass the entire xml code.

  • 1

    Would you like him to use the whole area? or would there be more composers beside him?

  • I’ve already edited now I tried using fill_parent and nothing

  • The xml code is on top

2 answers

1

Follow a simple example:

   <WebView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_gravity="center_vertical"
        android:id="@+id/webView2"
        android:background="#f0f0f0" />
  • still not giving if you want more information is at the top of the page

0

Beyond the android:layout_gravity="center_horizontal" put down android:gravity="center_horizontal"

Browser other questions tagged

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