I am making a game and i prepared a layout for my game but the layout gets changed after i run the app.It has also happened me before but i could find a way out of it.Let me know if you have any solution.I have also attached the pictures of my layout.
And also i wanna know how to prepare a responsive layout that runs and looks perfect on all android devices.
This is the Layout that i have prepared
This is what my layout becomes when i run the application
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Start!"
android:id="@+id/button"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:onClick="start"
android:visibility="visible"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/gameTimer"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:textSize="40sp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="0/0"
android:id="@+id/gameScore"
android:textSize="40sp"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:visibility="invisible"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="5+0"
android:id="@+id/gameSum"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:textSize="35sp"
android:visibility="invisible"/>
<GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/gameTimer"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginTop="25dp"
android:id="@+id/gridLayout"
android:visibility="invisible">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:id="@+id/button0"
android:layout_row="0"
android:layout_gravity="fill"
android:tag="0"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:layout_column="0"
android:padding="30dp"
android:textSize="40sp"
android:onClick="selectAnswer"
/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="3"
android:onClick="selectAnswer"
android:id="@+id/button1"
android:layout_row="1"
android:layout_gravity="fill"
android:tag="1"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="30dp"
android:textSize="40sp"
android:layout_column="0"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="selectAnswer"
android:text="3"
android:id="@+id/button2"
android:layout_row="0"
android:layout_gravity="fill"
android:tag="2"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="30dp"
android:textSize="40sp"
android:layout_column="1"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="5"
android:id="@+id/button3"
android:layout_row="1"
android:layout_gravity="fill"
android:onClick="selectAnswer"
android:tag="3"
android:layout_columnWeight="1"
android:layout_rowWeight="1"
android:padding="30dp"
android:textSize="40sp"
android:layout_column="1"/>
</GridLayout>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/answerStatus"
android:layout_below="@+id/gridLayout"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:textSize="40sp"/>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="PlayAgain!"
android:id="@+id/again"
android:layout_below="@+id/answerStatus"
android:layout_centerHorizontal="true"
android:onClick="reset"
android:visibility="invisible"/>
Aucun commentaire:
Enregistrer un commentaire