2014-01-22 28 views
0

我想在一種Android屏幕中使用三種重複的圖案作爲背景。以下是我想要達到的最終結果。一種Android屏幕的三種類型的瓷磚

Android screen

能將它的Android做什麼?

+0

是的,但你必須做出佈局。 – DaxeshKhatri

+1

答案是:**是的,你可以**。儘管我只能看到兩塊「瓷磚」(木頭和混凝土)。其餘的是圖標或背景。 –

+0

有一個影子落在木瓦上。無論如何,如果您能指出我可以在哪裏閱讀關於如何操作的教程,我將非常感激。 –

回答

0

在主佈局內部創建三個佈局實現了設計。

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" 
    tools:context=".SplashActivity" > 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="1dp" 
     android:layout_weight="4" 
     android:background="@drawable/woodentile" > 


    </RelativeLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0sp" 
     android:layout_weight="1" 
     android:background="@drawable/woodenshadowtile" > 
    </LinearLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="0sp" 
     android:layout_weight="1" 
     android:background="@drawable/papertile" > 
    </LinearLayout> 

</LinearLayout> 

您需要繪製文件夾中的三個位圖文件。我將以woodentile.xml爲例。

<?xml version="1.0" encoding="utf-8"?> 
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" 
    android:dither="true" 
    android:src="@drawable/inno_luck_wood_pattern_background" 
    android:tileMode="repeat" > 

</bitmap> 

就是這樣。這樣做會產生我想創建的那種設計。

0

創建繪製文件夾中的XML,並使用下面的代碼

<?xml version="1.0" encoding="utf-8"?> 
<bitmap xmlns:android="http://schemas.android.com/apk/res/android" 
    android:src="@drawable/YOUR_IMAGE 
    android:antialias="true" 
    android:dither="false" 
    android:filter="false" 
    android:gravity="fill" 
    android:tileMode="repeat" /> 

然後設置該文件到您的背景。 :)