0
在預覽中我讓我的app看起來像這樣。從預覽如何在Android studio中選擇位置文本和按鈕?
圖片:
不幸的是,當我啓動應用程序的樣子從測試
這
畫面和我的網頁代碼
<android.support.constraint.ConstraintLayout
android:layout_width="315dp"
android:layout_height="66dp"
tools:layout_editor_absoluteX="48dp"
tools:layout_editor_absoluteY="287dp">
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="212dp"
android:layout_height="36dp"
tools:layout_editor_absoluteX="70dp"
tools:layout_editor_absoluteY="232dp">
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="271dp"
android:layout_height="66dp"
tools:layout_editor_absoluteX="70dp"
tools:layout_editor_absoluteY="153dp">
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="218dp"
android:layout_height="51dp"
tools:layout_editor_absoluteX="2dp"
tools:layout_editor_absoluteY="4dp">
</android.support.constraint.ConstraintLayout>
<android.support.constraint.ConstraintLayout
android:layout_width="271dp"
android:layout_height="66dp"
tools:layout_editor_absoluteX="70dp"
tools:layout_editor_absoluteY="77dp">
</android.support.constraint.ConstraintLayout>
<TextView
android:id="@+id/textView8"
android:layout_width="218dp"
android:layout_height="51dp"
android:text="Se connecter"
android:textSize="30sp"
android:textStyle="bold"
tools:layout_editor_absoluteX="2dp"
tools:layout_editor_absoluteY="4dp" />
<EditText
android:id="@+id/editText2"
android:layout_width="270dp"
android:layout_height="67dp"
android:ems="10"
android:hint="Numero de telephone"
android:inputType="phone"
tools:layout_editor_absoluteX="70dp"
tools:layout_editor_absoluteY="77dp" />
<EditText
android:id="@+id/editText3"
android:layout_width="274dp"
android:layout_height="66dp"
android:ems="10"
android:hint="Mot de pass"
android:inputType="textPassword"
tools:layout_editor_absoluteX="70dp"
tools:layout_editor_absoluteY="153dp" />
<CheckBox
android:id="@+id/checkBox6"
android:layout_width="214dp"
android:layout_height="36dp"
android:text="rester connecte"
tools:layout_editor_absoluteX="70dp"
tools:layout_editor_absoluteY="232dp" />
<Button
android:id="@+id/button3"
android:layout_width="313dp"
android:layout_height="64dp"
android:text="Se connecter"
tools:layout_editor_absoluteX="48dp"
tools:layout_editor_absoluteY="287dp" />
爲什麼不直接使用Android Studio中的設計選項卡,以創建佈局? – gommb
是的,我確實使用了設計選項卡,但是當我啓動應用程序時,它看起來很糟糕 –
從代碼看,您似乎沒有使用佈局。嘗試使用相對佈局並將所有元素放置在其中。 – gommb