내가 가진 JSON
"GoogleMap으로"0 \ "스타일"\ FRAMEBORDER = "\"높이 = \ "450 \"폭 = \ "600 \"\의 u003ciframe의 SRC = \ "https://www.google.com/maps/embed?pb=!1m16!1m12!1m3!1d434549.40374533384!2d74.24349628287739!3d31.690830957117996!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!2m1!1sPakistan+Lahore!5e0!3m2!1sen!2s!4v1395138949280 = \ "국경 : 0 \"\ u003E 페이지의 \의 u003c/iframe이 \의 u003E 페이지 "
가 구문 분석 문자열에 ... 결과
문자열은 iframe ="https://www.google. com/maps/embed? pb =! 1m16! 1m12! 1m3! 1d434549.40374533384! 2d74.24349628287739! 3d31.690830957117996! 2m3! 1f0! 2f0! 3f0! 3m2! 1i1024! 2i768! 4f13.1! 2m1! 1sPakistan + Lahore ! 5e0! 3m2! 1sen! 2s! 4v1395138949280 width = 600 height = 450 frameborder = 0 style = border : 0 ";
레이아웃 :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".MainActivity" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:background="#00FF00" >
<TextView
android:id="@+id/header_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:text="Google Map"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textStyle="bold" />
</RelativeLayout>
<WebView
android:id="@+id/googlemap_webView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp" />
</LinearLayout>
자바 클래스 activity_main : MainActivity
public class MainActivity extends Activity {
private WebView googleMapWebView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initializeUI();
}
/**
* This method is used to Initialize UI components
*/
private void initializeUI() {
String iframe = "<iframe src=https://www.google.com/maps/embed?pb=!1m16!1m12!1m3!1d434549.40374533384!2d74.24349628287739!3d31.690830957117996!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!2m1!1sPakistan+Lahore!5e0!3m2!1sen!2s!4v1395138949280 width=600 height=450 frameborder=0 style=border:0</iframe>";
googleMapWebView = (WebView) findViewById(R.id.googlemap_webView);
googleMapWebView.getSettings().setJavaScriptEnabled(true);
googleMapWebView.loadData(iframe, "text/html", "utf-8");
}
}
의 AndroidManifest.xml
- 012,319,207,562,163,749,171,321 또한 0
첵 WIFI 권한 등
코드 만 추가하지 마십시오. 대답을 설명하십시오 – Jens
좋아요. iframe in android의 도움으로 webview에지도를 표시하기위한 코드 만 게시하십시오. –