使用XML布局文件控制UI界面
程序员文章站
2022-06-22 21:22:44
activity_main.xml中代码:
activity_main.xml中代码:
<?xml version="1.0" encoding="utf-8"?><FrameLayout 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:background="@mipmap/bg"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textSize="20sp"
android:textColor="#115572"
android:text="@string/start"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</FrameLayout>
strings.xml中代码:
<resources>
<string name="app_name">桌面台球</string>
<string name="start">开始游戏</string>
</resources>
本文地址:https://blog.csdn.net/weixin_44915319/article/details/107518261