[php] 안드로이드 웹뷰 정리 > 팁앤테크

본문 바로가기
사이트 내 전체검색

팁앤테크

[php] 안드로이드 웹뷰 정리

페이지 정보

본문

res/layout/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"
android:visibility="visible"
tools:layout_editor_absoluteX="8dp"
tools:layout_editor_absoluteY="8dp" />

</androidx.constraintlayout.widget.ConstraintLayout>


java/com.zeronara.webview/SplashActivity.java

package com.zeronara.webview;

import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Handler;
import android.os.Bundle;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);

Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
Intent intent = new Intent(getBaseContext(), MainActivity.class);
startActivity(intent);
finish();
}

}, 2000);
}
}


manifests/AndroidManifest.xml

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

<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:fullBackupContent="true"
android:icon="@drawable/splash"
android:label="@string/app_name"
android:roundIcon="@drawable/splash"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.NoActionBar.FullScreen"
android:usesCleartextTraffic="true"
android:hardwareAccelerated="true">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>


res/layout/activity_splash.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="#fff"
android:weightSum="1">

<ImageView
android:src="@drawable/splash"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:layout_weight="0.82" />
</LinearLayout>


res/values/styles.xml

<resources>
<!-- Base application theme. -->
<style name="Theme.AppCompat.Light.NoActionBar.FullScreen" parent="@style/Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<!-- add Style -->
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowFullscreen">false</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowBackground">@drawable/splash_background</item>
</style>
</resources>


java/com.zeronara.webview/MainActivity.java

package com.zeronara.webview;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MainActivity extends AppCompatActivity {
public WebView webView;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);

webView = (WebView)findViewById(R.id.webView);
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);

// 앱에서 표시할 url 입력
webView.loadUrl("https://zeronara.net");
webView.setWebViewClient(new WebViewClient());
}

//폰의 뒤로가기 버튼의 동작 입력
@Override
public void onBackPressed() {
if(webView.canGoBack()) {
webView.goBack();
} else {
super.onBackPressed();
}
}
}


res/values/strings.xml

<resources>
<string name="app_name">zeronara</string>
</resources>


res/values/colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#000000</color>
<color name="colorAccent">#D81B60</color>
<color name="colorSplashBackground">#FFFFFFFF</color>
</resources>


drawable/splash_background.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/colorSplashBackground"/>
<item>
<bitmap android:src="@drawable/splash" android:gravity="center" />
</item>
</layer-list>






추천0

댓글목록

등록된 댓글이 없습니다.

Total 126건 1 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 추천 날짜
126 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2908 0 01-01
125 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3577 0 12-29
열람중 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3393 0 12-10
123 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3242 0 11-29
122 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3083 0 10-20
121 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3862 0 09-14
120 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3777 0 05-14
119 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 5722 0 04-12
118 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18688 0 09-21
117 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 51834 0 07-10
116 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 19006 0 05-06
115 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 19150 0 03-25
114 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 18838 0 03-25
113 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 11629 0 03-16
112 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 16242 0 03-16
111 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9477 0 02-29
110 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10992 0 01-02
109 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 17380 0 10-21
108 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10637 0 08-21
107 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10487 0 08-15
106 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10459 0 08-12
105 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10157 0 04-25
104 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 10422 0 08-18
103 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9583 0 07-14
102 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 9320 0 07-10

검색

회원로그인

회원가입

사이트 정보

株式会社YHPLUS / 대표 : ZERO
〒140-0011 東京都品川区東大井2-5-9-203
050-5539-7787
오픈카카오톡 (YHPLUS) :
https://open.kakao.com/o/slfDj15d

접속자집계

오늘
5,078
어제
5,850
최대
7,259
전체
1,216,030
Copyright (c) 株式会社YHPLUS. All rights reserved.