ผลต่างระหว่างรุ่นของ "Sw-spec/2048"
ไปยังการนำทาง
ไปยังการค้นหา
Jittat (คุย | มีส่วนร่วม) (หน้าที่ถูกสร้างด้วย ''''activity_main.xml''' <syntaxhighlight lang="xml"> <TextView android:id="@+id/cell00" android:layout_width="wrap_...') |
Jittat (คุย | มีส่วนร่วม) |
||
แถว 1: | แถว 1: | ||
+ | == Layout == | ||
+ | '''res/drawable/cell_back.xml''' | ||
+ | <syntaxhighlight lang="xml"> | ||
+ | <?xml version="1.0" encoding="utf-8"?> | ||
+ | <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > | ||
+ | <solid android:color="@android:color/white" /> | ||
+ | <stroke android:width="1dip" android:color="#707070"/> | ||
+ | </shape> | ||
+ | </syntaxhighlight> | ||
+ | |||
'''activity_main.xml''' | '''activity_main.xml''' | ||
<syntaxhighlight lang="xml"> | <syntaxhighlight lang="xml"> |
รุ่นแก้ไขเมื่อ 18:45, 15 มีนาคม 2561
Layout
res/drawable/cell_back.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@android:color/white" />
<stroke android:width="1dip" android:color="#707070"/>
</shape>
activity_main.xml
<TextView
android:id="@+id/cell00"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell01"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell01"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell02"
app:layout_constraintLeft_toRightOf="@id/cell00"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell02"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell03"
app:layout_constraintLeft_toRightOf="@id/cell01"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell03"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintLeft_toRightOf="@id/cell02"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell10"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell11"
app:layout_constraintTop_toBottomOf="@id/cell00"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell11"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell12"
app:layout_constraintLeft_toRightOf="@id/cell10"
app:layout_constraintTop_toBottomOf="@id/cell00"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell12"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell13"
app:layout_constraintLeft_toRightOf="@id/cell11"
app:layout_constraintTop_toBottomOf="@id/cell00"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell13"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintLeft_toRightOf="@id/cell12"
app:layout_constraintTop_toBottomOf="@id/cell00"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell20"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell21"
app:layout_constraintTop_toBottomOf="@id/cell10"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell21"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell22"
app:layout_constraintLeft_toRightOf="@id/cell20"
app:layout_constraintTop_toBottomOf="@id/cell10"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell22"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell23"
app:layout_constraintLeft_toRightOf="@id/cell21"
app:layout_constraintTop_toBottomOf="@id/cell10"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell23"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintLeft_toRightOf="@id/cell22"
app:layout_constraintTop_toBottomOf="@id/cell10"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell30"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell31"
app:layout_constraintTop_toBottomOf="@id/cell20"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell31"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell32"
app:layout_constraintLeft_toRightOf="@id/cell30"
app:layout_constraintTop_toBottomOf="@id/cell20"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell32"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintRight_toLeftOf="@id/cell33"
app:layout_constraintLeft_toRightOf="@id/cell31"
app:layout_constraintTop_toBottomOf="@id/cell20"
android:gravity="center"
android:text="2048"/>
<TextView
android:id="@+id/cell33"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:minWidth="70dp"
android:textAppearance="@style/Base.TextAppearance.AppCompat.Medium"
app:layout_constraintDimensionRatio="1:1"
android:background="@drawable/cell_back"
app:layout_constraintLeft_toRightOf="@id/cell32"
app:layout_constraintTop_toBottomOf="@id/cell20"
android:gravity="center"
android:text="2048"/>
<Button
android:id="@+id/restartButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/cell33"
android:text="Restart"/>
<Button
android:id="@+id/leftButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/restartButton"
android:text="Left"/>
<Button
android:id="@+id/upButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/restartButton"
app:layout_constraintLeft_toRightOf="@id/leftButton"
android:text="Up"/>
<Button
android:id="@+id/downButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/restartButton"
app:layout_constraintLeft_toRightOf="@id/upButton"
android:text="Down"/>
<Button
android:id="@+id/rightButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/restartButton"
app:layout_constraintLeft_toRightOf="@id/downButton"
android:text="Right"/>