安卓开发小记(纯新手)
效果图如下:
软件效果图

打开界面出现

在\res\values 文件夹中我们找到 strings.xml
这里我们能更改软件名
1 2 3
| <resources> <string name="app_name">糖心vlog</string> </resources>
|
在\manifests下我们找到AndroidManifest.xml(也叫清单文件)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| <?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/tangxing" /*软件图标*/ android:label="@string/app_name"/*软件名*/ android:roundIcon="@mipmap/tangxing"/*软件图标*/ android:supportsRtl="true" android:theme="@style/Theme.MyApplication" tools:targetApi="31"> <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>
|
@mipmap 意思是在mipmap目录下的什么文件
图片技术在MainActivity.java文件里
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| package com.example.myapplication;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle; import android.util.Log; import android.widget.ImageView; import android.widget.TextView; import com.bumptech.glide.Glide; public class MainActivity extends AppCompatActivity { private TextView tv_glide; private ImageView iv_glide; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv_glide = (TextView) findViewById(R.id.tv_glide); iv_glide = (ImageView) findViewById(R.id.iv_glide); String url = "https://c.img.dasctf.com/LightPicture/2025/06/d2dbbefe1c5dabbd.png"; tv_glide.setText("孩子们我回来了!"); Glide.with(this).load(url).into(iv_glide); } }
|
url后放的是图片链接(注意是从网络中下的图片后缀)
界面设计activity_main.xml文件在\res\layout中找到
内容如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| <?xml version="1.0" encoding="utf-8"?> <LinearLayout 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" tools:context=".MainActivity">
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv_glide" /> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/iv_glide" />
</LinearLayout>
|
1 2 3
| <LinearLayout //垂直方向 <TextView //文字组件 <ImageView //ImageView图片组件
|
因为运用了glide技术所以我们需要在Gradle Scripts里面的build.gradle.kts(app)

在文件中dependencies 中放入,如以下
1
| dependencies {implementation("com.github.bumptech.glide:glide:4.15.0")}
|
com.github.bumptech.glide:glide:4.15.0这个数据是我在这个网站
1
| https://mvnrepository.com/artifact/com.github.bumptech.glide/glide/4.15.0
|
复制到的很多开源的功能都可以在这个网站引用
