투케이2K

810. (Android/Xml) 안드로이드 RelativeLayout 사용해 웹뷰에 커스텀 로딩 프로그레스 생성 - Webview Custom Progress 본문

Android

810. (Android/Xml) 안드로이드 RelativeLayout 사용해 웹뷰에 커스텀 로딩 프로그레스 생성 - Webview Custom Progress

투케이2K 2024. 6. 25. 19:39
반응형

[개발 환경 설정]

개발 툴 : AndroidStudio

개발 언어 : Java / Kotlin

 

[소스 코드]

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"
    android:orientation="vertical">


    <!-- 컴포넌트 : 웹뷰 : 전체 화면 지정 -->
    <WebView
        android:id="@+id/main_webview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#343d46" />


    <!-- 컴포넌트 : ProgressBar 원형 프로그레스 : 웹뷰 위에 표시 -->
    <!-- android:layout_alignParent 속성을 사용해서 가운데 위치 정렬 -->
    <!-- android:background="#66000000" : 검정색 배경 투명도 40 퍼센트 설정 -->
    <RelativeLayout
        android:layout_width="80dp"
        android:layout_height="80dp"
        android:gravity="center"
        android:layout_centerInParent="true"
        android:orientation="vertical"
        android:background="#66000000">

        <!-- indeterminateTint : 원형 프로그레스 색상 변경 실시 -->
        <ProgressBar
            android:id="@+id/progressBar"
            style="?android:attr/progressBarStyle"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:indeterminateTint="#a7eeff"
            android:layout_marginBottom="15dp"
            android:layout_marginRight="15dp"
            android:layout_marginLeft="15dp"/>

        <!-- 닫기 가능 여부 표시 위해 텍스트 지정 -->
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="close"
            android:textColor="#ffffff"
            android:textStyle="bold"
            android:textSize="12dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_marginRight="5dp"
            android:layout_marginBottom="5dp"/>

    </RelativeLayout>

</RelativeLayout>
 

[결과 출력]


반응형
Comments