diff --git a/.gitignore b/.gitignore
index aa724b7..49463a0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,19 @@
*.iml
.gradle
/local.properties
-/.idea/caches
-/.idea/libraries
-/.idea/modules.xml
-/.idea/workspace.xml
-/.idea/navEditor.xml
-/.idea/assetWizardSettings.xml
+/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties
+/wrapper
+/daemon
+/cache
+/native
+/jdks
+/android
+/.tmp
+/kotlin-profile
+
diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml
deleted file mode 100644
index fcc5e40..0000000
--- a/.idea/deploymentTargetSelector.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index b750540..8716c94 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -65,6 +65,7 @@ dependencies {
implementation(libs.androidx.material3)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
+ implementation("androidx.activity:activity-ktx:1.9.2")
implementation(libs.material)
testImplementation(libs.junit)
diff --git a/app/src/main/java/com/example/lobchat/WebViewActivity.kt b/app/src/main/java/com/example/lobchat/WebViewActivity.kt
index e64dd06..a282aa1 100644
--- a/app/src/main/java/com/example/lobchat/WebViewActivity.kt
+++ b/app/src/main/java/com/example/lobchat/WebViewActivity.kt
@@ -49,6 +49,18 @@ class WebViewActivity : AppCompatActivity() {
}
}
+ // 增加处理Android返回键逻辑
+ override fun onBackPressed() {
+ if (webView.canGoBack()) {
+ // 如果WebView能够返回上一页
+ webView.goBack()
+ } else {
+ // 否则调用super以处理默认的后退行为
+ super.onBackPressed()
+ }
+ }
+
+
private fun setupWebView() {
val webSettings: WebSettings = webView.settings
webSettings.javaScriptEnabled = true
diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml
index ee2b36b..0006c88 100644
--- a/app/src/main/res/layout/activity_main.xml
+++ b/app/src/main/res/layout/activity_main.xml
@@ -1,91 +1,81 @@
+ android:layout_height="match_parent">
-
-
-
-
-
-
-
-
-
-
-
-