2023/2/28每日总结

今天学了一点点:

把 App 的界面设计与代码逻辑分开的好处:
使用XML 文件描述 APP 界面,可以很方便地在 Android Studio 上预览界面效果。
一个界面布局可以被多处代码复用,反过来,一个 Java 代码也可能适配多个界面布局。

一下为所写代码

activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout//线性布局
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"//match_parent 屏幕多大就显示多大
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center">//居中显示
<TextView//子空间布局
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="hello world">//显示的文字
</TextView>
</LinearLayout>
posted @ 2023-03-02 18:18  呦吼吼吼  阅读(17)  评论(0)    收藏  举报