移动应用开发技术 第一章(用于期末考试复习)

调用图片资源

(1)java

调用mipmap中

getResources().getDrawable(R.mipmap.ic_launcher);

调用以drawable 开头的文件夹

getResources().getDrawable(R.drawable.icon);

(2)xml

@mipmap/ic_launcher

@drawable/icon

<style></style>:定义主题的标签

<item></item>:设置主题样式的标签

设置主题

(1)androidmanifest.xml

android:theme ="@style/AppTheme"

(2)java

setTheme(R.style.apptheme);

<style></style>:定义样式的标签

<item></item>:设置控件样式的标签

xml中引用样式

style="@style/textviewstyle"

布局资源

(1)java

//在Activity的onCreate()方法中调用activity_main.xml布局文件

setcontentview(R.layout.activity_main);

(2)xml

<include layout="@layout/activity_main/">

字符串

<string></string>:定义字符串的标签

<resources>

<string name="app_name">字符串</string>

</resources>

(1)java

getResources().getString(R.string.app.name);

(2)xml

@string/app_name

颜色

<color></color>:定义颜色的标签

<resources>

<color name="colorPrimary">#3F51B5</color>

</resources>

(1)java

getResources().getColor(R.color.colorPrimary);

(2)xml

@color/colorPrimary

尺寸

<dimen></dimen>:定义尺寸的标签

<resources>

<dimen name="activity_horizontal_margin">16dp</dimen>

</resources>

(1)java

getReources().getDimension(R.dimen.activity_horizontal_margin);

(2)xml

@dimen/activity_horizontal_margin

单元测试是指在Android程序开发过程中对最小的功能模块进行测试,单元测试包括Android单元测试和Junit单元测试。

LogCat是Android中的命令行工具,用于获取程序从启动到关闭的日志信息。

Log类所输出的日志内容分为六个级别。

相关推荐
我命由我123453 天前
Android 开发问题:项目同时引入了两个包含相同类文件的库(AndroidX 库、旧版本支持库),导致了重复类错误
android·java·java-ee·android studio·android-studio·androidx·android runtime
我命由我123453 天前
Retrofit - URL 格式错误问题、支持 HTTP 与 HTTPS
java·http·https·java-ee·android studio·android-studio·retrofit
我命由我123454 天前
Bugly - Bugly 基本使用( App 质量追踪平台)
android·java·java-ee·android studio·android jetpack·android-studio·android runtime
我命由我123457 天前
Android Framework P4 - ServiceManager 进程
android·c语言·c++·visualstudio·android studio·android-studio·android runtime
我命由我1234512 天前
Android 开发问题:TextView 内容超过宽度时,默认不会换行
android·开发语言·java-ee·android studio·android jetpack·android-studio·android runtime
我命由我1234514 天前
Android 开发:Unable to start service Intent { ... } U=0: not found
android·开发语言·android studio·android jetpack·android-studio·android runtime
敲代码的瓦龙15 天前
Android?广播!!!
android·java·开发语言·android-studio
我命由我1234516 天前
Android Framework P1 - 低配学习 Framework 方案、开机启动 Init 进程
android·c语言·c++·学习·android jetpack·android-studio·android runtime
我命由我1234521 天前
Jetpack Compose - 设置 Compose 编译器、设置 Compose 依赖项
android·java·java-ee·kotlin·android jetpack·android-studio·android runtime
敲代码的瓦龙22 天前
Android?碎片!!!
java·开发语言·android-studio