2016-06-18 3 views
0

웹 뷰를 표시하고 싶습니다. 하지만 나타나지 않습니다. 이 코드를 수정 해 주시겠습니까? 하여 오류가 XML 코드 나 자바 코드에있는 경우 내가어떻게 웹 뷰를 표시 할 수 있습니까?

<ScrollView 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    xmlns:card_view="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/scrollView" 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:androido="http://schemas.android.com/tools"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 
      <android.support.v7.widget.CardView 
       android:id="@+id/cardview" 
       android:layout_width="fill_parent" 
       android:layout_height="wrap_content" 
       card_view:cardBackgroundColor="@android:color/white" 
       card_view:cardCornerRadius="8dp" 
       card_view:cardElevation="20dp" 
       android:layout_margin="10dp"> 

       <LinearLayout 
        android:layout_width="match_parent" 
        android:layout_height="match_parent" 
        android:orientation="vertical"> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="50dp" 
         android:gravity="center_vertical" 
         android:background="@color/lignt_blue" 
         android:paddingLeft="25dp"> 

         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Cordonnées" 
          android:textSize="14sp"/> 
        </LinearLayout> 

        <View 
         android:layout_width="match_parent" 
         android:layout_height="2dp" 
         android:background="@color/navy" /> 

        <LinearLayout 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:orientation="vertical" 
         android:paddingLeft="10dp" 
         android:paddingRight="10dp" 
         android:paddingTop="20dp" 
         android:paddingBottom="10dp"> 
         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Login" 
          android:id="@+id/textLog" 
          android:textStyle="bold" 
          android:textSize="20sp"/> 
         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:enabled="false" 
          android:textColor="@color/black" 
          android:id="@+id/editTextlog"/> 
         <View 
          android:layout_width="match_parent" 
          android:layout_margin="10dp" 
          android:layout_height="2dp" 
          android:background="@android:color/darker_gray" /> 
         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Nom" 
          android:id="@+id/textNom" 
          android:textStyle="bold" 
          android:textSize="20sp"/> 
         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:enabled="false" 
          android:textColor="@color/black" 
          android:id="@+id/editTextId"/> 
         <View 
          android:layout_width="match_parent" 
          android:layout_margin="10dp" 
          android:layout_height="2dp" 
          android:background="@android:color/darker_gray" /> 
         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:text="Prenom" 
          android:textStyle="bold" 
          android:id="@+id/textPrenom" 
          android:textSize="20sp"/> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:enabled="false" 
          android:id="@+id/editTextName" 
          android:textColor="@color/black"/> 
         <View 
          android:layout_width="match_parent" 
          android:layout_margin="10dp" 
          android:layout_height="2dp" 
          android:background="@android:color/darker_gray" /> 
         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:id="@+id/textEmail" 
          android:textStyle="bold" 
          android:text="Email" 
          android:textSize="20sp"/> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:id="@+id/editTextSalary" 
          android:textColor="@color/black"/> 
         <View 
          android:layout_width="match_parent" 
          android:layout_margin="10dp" 
          android:layout_height="2dp" 
          androido:background="@android:color/darker_gray" /> 
         <TextView 
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:id="@+id/textTel" 
          android:textStyle="bold" 
          android:text="Téléphone" 
          android:textSize="20sp"/> 

         <TextView 
          android:layout_width="match_parent" 
          android:layout_height="wrap_content" 
          android:clickable="true" 
          android:autoLink="phone" 
          android:id="@+id/editTextTel" 
          android:textColor="@color/black" /> 


        </LinearLayout> 
       </LinearLayout> 
      </android.support.v7.widget.CardView> 

     <WebView xmlns:android="http://schemas.android.com/apk/res/android" 
      android:id="@+id/webview" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      /> 
</LinearLayout> 
    </ScrollView> 

내가 데이터베이스에서 위도와 경도와 내 웹보기를 추가 이해하지 못했다

자바 코드

String latitude=c.getString("latitude"); 
      String longitude =c.getString("longitude"); 
      browser.setWebViewClient(new MyBrowser()); 
      browser.getSettings().setLoadsImagesAutomatically(true); 
      browser.getSettings().setJavaScriptEnabled(true); 
      browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); 
      browser.loadUrl("http://maps.google.com/maps?q=" + latitude + "," + longitude); 
+0

위도, 경도가 빈 문자열 일 수 있습니다. 한 번 확인하십시오 –

+0

비어 있지 않습니다. Log.e ("위도", 위도)를 이미 사용했습니다. Log.e ("경도", 경도) ;. 값을 반환합니다. – Joelle

답변

0

MyBrowser 수업을 지나서 주시겠습니까? 하나의 작은 팁 - 일부 스타일로 레이아웃 코드를 변경하십시오. 당신은 동일한 TextView와 View의 톤을 가지고 있습니다. 동일한 속성을 스타일로 이동하면 XML이 짧아지고 우아 해집니다.

+0

공용 클래스 MyBrowser는 WebViewClient를 확장합니다. { @Override public boolean shouldOverrideUrlLoading (WebView view, String url) { view.loadUrl (url); return true; } } – Joelle

+0

WebView의 높이 (예 : 200dp)를 추가하면 나타납니다. –

관련 문제