[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 825건 2 페이지
  • RSS
팁앤테크 목록
번호 제목 글쓴이 조회 추천 날짜
800 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3433 0 02-28
799 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3857 0 02-28
798 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4734 0 02-28
797 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2632 0 02-27
796 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2903 0 02-27
795 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2698 0 02-26
794 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2837 0 02-26
793 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2986 0 02-22
792 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2726 0 02-15
791 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2908 0 01-01
790 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3574 0 12-29
789 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3285 0 12-20
788 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2896 0 12-15
열람중 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3388 0 12-10
786 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3241 0 11-29
785 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 2789 0 10-31
784 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3082 0 10-20
783 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3860 0 09-14
782 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3831 0 06-20
781 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3934 0 06-20
780 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3394 0 05-18
779 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3093 0 05-17
778 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3776 0 05-14
777 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 4165 0 05-14
776 제로쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 3048 0 05-14

검색

회원로그인

회원가입

사이트 정보

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

접속자집계

오늘
3,135
어제
5,850
최대
7,259
전체
1,214,087
Copyright (c) 株式会社YHPLUS. All rights reserved.