在进行对于app的创建之前是对于android studio的相关安装的环境的配置,完成这些之后自己就写个一个简单的helloword的实例进行了测试。之后通过进一步的向下挖掘,发现当将helloword改成中文的时候就会出现错误,通过网上的学习找的了解决办法,就是打开res/valus/strings.xml,添加<string name="wenxuezhi">按钮</string>之后再将刚才的把刚刚的Button控件设置为android:text="@string/wenxuezhi"这样就会将上边的中文字在手机界面上正常输出了。

具体相关的代码如下:

strings.xml

<resources>
<string name="app_name">温 My Application home</string>
<string name="wenxuezhi">我很棒</string>
</resources>

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"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content" android:text="@string/wenxuezhi"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.436" /> </androidx.constraintlayout.widget.ConstraintLayout>

MainActivity

package com.example.myapplicationhome;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

    @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}

AndroidMainifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.myapplicationhome"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>

最新文章

  1. 飞鱼(FlyFish)——便捷的原型在线制作工具
  2. MySQL之浅谈MySQL的存储引擎
  3. ip数据结构
  4. Java 前端加密传输后端解密以及验证码功能
  5. java pdf转换jpg
  6. USB硬件远程共享解决iphone已停用
  7. 如何在C#中使用全局鼠标、键盘Hook
  8. Ubuntu下PHP开发配置(新增redis、sphinx、sqlserver相关配置)
  9. 【转】Nginx系列(三)--管理进程、多工作进程设计
  10. C#中byte[] 与指针
  11. 解决PowerDesigner中DBMS设置的问题(Repost)
  12. TF卡速度测试对比 Class数越高速度越快
  13. C++编程命名规范
  14. python3打开winodows文件问题
  15. D3.js 入门学习(一)
  16. 洛谷 P3376 【【模板】网络最大流】
  17. [Python设计模式] 第6章 衣服搭配系统——装饰模式
  18. js模拟散列
  19. IBM研究院找到度量安全性方法:容器与虚拟机,谁更安全?
  20. level1 - unit 1 - 句子结构

热门文章

  1. Java反射之成员变量的反射
  2. SyntaxError: unexpected character after line continuation character
  3. Gorm 预加载及输出处理(二)- 查询输出处理
  4. 【转】sublime text 2中Emmet插件8个常用的技巧
  5. How to do error checking in CUDA(如何在CUDA里做错误检查)
  6. 都2020年了 还要学JSP吗?
  7. Natas33 Writeup(Phar反序列化漏洞)
  8. CSS劫持攻击
  9. masql数据库的表查询
  10. CF1326A Bad Ugly Numbers 题解