จั่นเจาดอทคอม ถามตอบ คอมพิวเตอร์ อินเตอร์เน็ต Forex MT4 MT5 เทรดทอง

คอมพิวเตอร์ อินเตอร์เน็ต => การเขียนโปรแกรม Mobile App , Web App => Topic started by: junjao on April 30, 2021, 08:31:42 PM

Title: webview kotlin code android studio 4.1.3 3 ไฟล์ 30/4/2564
Post by: junjao on April 30, 2021, 08:31:42 PM
ผมได้เขียน app webview kotlin android studio 4.1.3 ใหม่

code ตัวเก่าใช้งานไม่ได้แล้ว ให้เขียนใหม่ดังนี้

1. activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <WebView
        android:id="@+id/webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        />

</androidx.constraintlayout.widget.ConstraintLayout>
--------------------------------------------------------
2. MainActivity.kt
package xxx ชื่อโปรเจ็คของคุณ xxxx

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.webkit.WebView

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val myWebView: WebView = findViewById(R.id.webview)
        myWebView.loadUrl("https://www.xxxxxxxx.com")
    }
}
----------------------------------
3.AndroidManifest.xml
<manifest ... >
    <uses-permission android:name="android.permission.INTERNET" />
    ...
</manifest>
-------------------------------------

เขียน app webview ราคา 10,000 บาท พร้อมขึ้น google play
สรพล
jun_jao2000@hotmail.com