This commit is contained in:
@@ -1,11 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<!-- 网络权限 -->
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:label="@string/app_name"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar">
|
||||
android:theme="@android:style/Theme.DeviceDefault.Light.NoActionBar"
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<activity
|
||||
android:name=".MainActivity"
|
||||
|
||||
@@ -3,14 +3,22 @@ package com.arkj.app;
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class MainActivity extends Activity {
|
||||
// 轮播图 URL
|
||||
private static final String CAROUSEL_URL = "https://alist.kg8.net/d/蓝奏云/IMG_20190602_082558.webp";
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_main);
|
||||
|
||||
// 加载轮播图
|
||||
loadCarousel();
|
||||
|
||||
// 设置功能按钮点击事件
|
||||
setupFunctionButtons();
|
||||
|
||||
@@ -18,6 +26,20 @@ public class MainActivity extends Activity {
|
||||
setupBottomNavigation();
|
||||
}
|
||||
|
||||
private void loadCarousel() {
|
||||
WebView carouselWebView = findViewById(R.id.carouselWebView);
|
||||
WebSettings settings = carouselWebView.getSettings();
|
||||
settings.setJavaScriptEnabled(true);
|
||||
settings.setLoadWithOverviewMode(true);
|
||||
settings.setUseWideViewPort(true);
|
||||
|
||||
// 加载网络图片
|
||||
String html = "<html><body style='margin:0;padding:0;'>" +
|
||||
"<img src='" + CAROUSEL_URL + "' style='width:100%;height:100%;object-fit:cover;' />" +
|
||||
"</body></html>";
|
||||
carouselWebView.loadDataWithBaseURL(null, html, "text/html", "UTF-8", null);
|
||||
}
|
||||
|
||||
private void setupFunctionButtons() {
|
||||
// 备忘录
|
||||
findViewById(R.id.btnMemo).setOnClickListener(v ->
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- 搜索图标 - 加深颜色 -->
|
||||
<!-- 搜索图标 - 深色 -->
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="20dp"
|
||||
android:height="20dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24">
|
||||
<path
|
||||
android:fillColor="#6B7280"
|
||||
android:fillColor="#1F2937"
|
||||
android:pathData="M15.5,14h-0.79l-0.28,-0.27C15.41,12.59 16,11.11 16,9.5 16,5.91 13.09,3 9.5,3S3,5.91 3,9.5 5.91,16 9.5,16c1.61,0 3.09,-0.59 4.23,-1.57l0.27,0.28v0.79l5,4.99L20.49,19l-4.99,-5zM9.5,14C7.01,14 5,11.99 5,9.5S7.01,5 9.5,5 14,7.01 14,9.5 11.99,14 9.5,14z"/>
|
||||
</vector>
|
||||
@@ -76,23 +76,15 @@
|
||||
android:focusable="true"/>
|
||||
</LinearLayout>
|
||||
|
||||
<!-- 轮播图 -->
|
||||
<LinearLayout
|
||||
<!-- 轮播图 - 使用 WebView 加载网络图片 -->
|
||||
<WebView
|
||||
android:id="@+id/carouselWebView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="180dp"
|
||||
android:layout_marginHorizontal="24dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_carousel"
|
||||
android:elevation="4dp">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@drawable/carousel_image"
|
||||
android:scaleType="centerCrop"
|
||||
android:contentDescription="轮播图"/>
|
||||
</LinearLayout>
|
||||
android:elevation="4dp"/>
|
||||
|
||||
<!-- 功能网格标题 -->
|
||||
<TextView
|
||||
|
||||
Reference in New Issue
Block a user