打2014年入行开始,兜兜转转四五年,我还是又重做了一遍Android的项目,从安装Android Studio开始,从布局开始的那种,希望以往easy的事情,现在仍然是easy的,因为这必然是easy的。
1.Android中的线性布局:
<?xml version="1.0" encoding="utf-8"?>
<!--<android.support.constraint.ConstraintLayout>-->
<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="horizontal"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:layout_weight="1"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button1"
android:layout_weight="1"
tools:layout_editor_absoluteX="47dp"
tools:layout_editor_absoluteY="16dp" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button2"
android:layout_weight="1"
tools:layout_editor_absoluteX="47dp"
tools:layout_editor_absoluteY="118dp" />
</LinearLayout>
<!--</android.support.constraint.ConstraintLayout>-->