.xml 文件
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/animal_bg"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingRight="15dp">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="200dp"
android:orientation="20">
<Button
style="@style/btnStyle"
android:layout_width="70dp"
android:background="@drawable/three" />
<Button
style="@style/btnStyle"
android:background="@drawable/four" />
<Button
style="@style/btnStyle"
android:background="@drawable/box" />
<Button
style="@style/btnStyle"
android:background="@drawable/five" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<Button
style="@style/btnStyle"
android:layout_width="70dp"
android:background="@drawable/one" />
<Button
style="@style/btnStyle"
android:background="@drawable/two" />
<Button
style="@style/btnStyle"
android:background="@drawable/box" />
<Button
style="@style/btnStyle"
android:background="@drawable/four" />
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:orientation="horizontal">
<Button
style="@style/btnStyle"
android:layout_width="70dp"
android:background="@drawable/five" />
<Button
style="@style/btnStyle"
android:background="@drawable/box" />
<Button
style="@style/btnStyle"
android:background="@drawable/three" />
<Button
style="@style/btnStyle"
android:background="@drawable/two" />
</LinearLayout>
</LinearLayout>
.style样式文件
<resources>
Base application theme.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="btnStyle">
<item name="android:layout_width">70dp</item>
<item name="android:layout_height">70dp</item>
<item name="android:layout_marginRight">15dp</item>
</style>
</resources>
结果图:
*后期会逐步更新练练看逻辑代码…(敬请期待。。。)