2026, 새로운 도약을 시작합니다.

안드로이드 웹뷰어

링크주소에 안드로이드 스튜디오에서 다운받아서 설치 후 아래 소스를 추가하면 끝...

AI로 하니 금방 만들수 있네요..

MainActivity.kt

[code]

package com.seoul.seoulforeign

import android.annotation.SuppressLint
import android.os.Bundle
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.viewinterop.AndroidView
import com.seoul.seoulforeign.ui.theme.SeoulForeignTheme

class MainActivity : ComponentActivity() {

    // WebView를 참조할 변수 선언
    private lateinit var webView: WebView

    @SuppressLint("SetJavaScriptEnabled")
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            SeoulForeignTheme {
                Scaffold(modifier = Modifier.fillMaxSize()) { innerPadding ->
                    WebViewer(
                        url = "https://sir.kr",
                        modifier = Modifier.padding(innerPadding),
                        onWebViewCreated = { webView = it }
                    )
                }
            }
        }
    }

    // 뒤로가기 버튼 처리
    override fun onBackPressed() {
        if (::webView.isInitialized && webView.canGoBack()) {
            webView.goBack()
        } else {
            finish() // 앱 종료
        }
    }
}

@Composable
fun WebViewer(
    url: String,
    modifier: Modifier = Modifier,
    onWebViewCreated: (WebView) -> Unit
) {
    AndroidView(
        modifier = modifier.fillMaxSize(),
        factory = { context ->
            WebView(context).apply {
                webViewClient = WebViewClient()
                settings.javaScriptEnabled = true
                loadUrl(url)
                onWebViewCreated(this)
            }
        }
    )
}

[/code]

AndroidManifest.xml

[code]

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <!-- ? 인터넷 권한 추가 -->
    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.SeoulForeign">

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:label="@string/app_name"
            android:theme="@style/Theme.SeoulForeign">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

</manifest>

[/code]

구글 스토어에 업로드 할려면 비용이 들지만...

|

댓글 2개

오! 카이루님 유튜브도 활동중인가봐요

@비버팩토리2011. 12. 25. 가입했습니다 수입창출없는 채널

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

앱개발

번호 분류 제목 글쓴이 날짜 조회
758 Android 5개월 전 조회 292
757 Hybrid 7개월 전 조회 347
756 기타 2년 전 조회 1,351
755 Hybrid 2년 전 조회 1,618
754 Hybrid 2년 전 조회 2,451
753 Android 2년 전 조회 1,282
752 기타 3년 전 조회 1,443
751 Hybrid 3년 전 조회 1,158
750 Hybrid 3년 전 조회 2,439
749 Hybrid 3년 전 조회 1,605
748 IOS 3년 전 조회 2,155
747 기타 3년 전 조회 1,712
746 기타 3년 전 조회 1,791
745 IOS 3년 전 조회 1,679
744 기타
[기타]
3년 전 조회 1,198
743 Hybrid 3년 전 조회 1,579
742 기타 3년 전 조회 1,896
741 기타 3년 전 조회 1,618
740 기타 3년 전 조회 1,427
739 기타 4년 전 조회 1,944
738 Android 4년 전 조회 2,342
737 Hybrid 4년 전 조회 1,728
736 Android 4년 전 조회 1,759
735 기타 4년 전 조회 1,967
734 IOS 4년 전 조회 1,676
733 기타 4년 전 조회 1,739
732 기타 4년 전 조회 2,085
731 기타 4년 전 조회 1만
730 기타 4년 전 조회 2,386
729 기타
[기타]
4년 전 조회 2,138
🐛 버그신고