2012-03-28 75 views
0

所以,我要顯示日程表,其中每一個項目都有一個帶圓角的背景圖片...的BackgroundImage重複+圓角

我不能找出如何讓我的觀點(目前一個TextView,但我可以更改),背景(這是必須重複的模式),並給它圓潤的邊角...

所有我能找到的是如何給圓角了堅實的背景顏色...

任何人都可以幫忙嗎?

編輯:將backgroundImage看起來像這樣http://www.photoshop-pack.com/tutorials/images/1145.gif


帶圓角的背景圖片:排不上的所有項目具有相同的長度

左角落+主BG +右角落:BG應重複,所以右角不會與中心bg

+0

我想我回答了這個同樣的問題[這裏] [1]。 [1]:http://stackoverflow.com/a/15148400/714249 – Splash 2013-03-01 00:39:01

回答

0

具有圓角的背景圖像:並非計劃中的所有項目都具有相同的長度

左角落+主BG +右角落:BG應該重複這樣的右下角難道不陣容中心BG

u能佈局後的圖像?

+0

見編輯:背景圖像看起來像http://www.photoshop-pack.com/tutorials/images/1145.gif – Ferdau 2012-03-28 09:55:26

+0

創建XML像以下<位圖 的xmlns:機器人= 「http://schemas.android.com/apk/res/android」 機器人:SRC = 「@繪製/量程1」 機器人:TILEMODE = 「重複」 android:dither =「true」/> http://androidforbeginners.blogspot.in/2010/06/how-to-tile-background-image-in-android.html檢查此鏈接http://androidforbeginners.blogspot.in /2010/06/how-to-tile-background-image-in-android.html – Aditya 2012-03-28 10:09:30

+1

圓角的情況如何?(提前感謝)我知道如何設置背景+重複它只是圓角是屁股疼痛! – Ferdau 2012-03-28 10:24:38

3

類似

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="center_horizontal" 
    > 
<LinearLayout 
    android:padding="4dip" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/list_bkg_rounded" 
    android:gravity="center_horizontal" 
    > 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="hello all how are you ? " 
    android:background="@drawable/back_repeat" 
    /> 
</LinearLayout> 
</LinearLayout> 

我有這樣的事情 rounded pattern

+1

這裏list_bkg_rounded是一個xml,它繪製圓角 – Aditya 2012-03-28 10:48:00

+0

我不斷收到:需要一個有效的src屬性...刷新,清理,刪除圖像,再次添加,...沒有作品任何想法? – Ferdau 2012-03-28 13:41:25

+0

是否在您的XML文件中添加了<?xml version =「1.0」encoding =「utf-8」?>?? – Aditya 2012-03-28 14:15:24

1

讓我後我的代碼在這裏 我back_repeat.xml在繪製文件夾

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

和重複一些事情.gif在繪製文件夾中,這是來自ur鏈接的backgroundimage。

也list_bkg_rounded.xml在繪製文件夾這是圓角邊框

<?xml version="1.0" encoding="UTF-8"?> 
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> 
    <stroke android:width="1dp" android:color="#fc9700"/> 
    <corners android:bottomRightRadius="10dp" android:bottomLeftRadius="10dp" 
    android:topLeftRadius="10dp" android:topRightRadius="10dp"/> 
    <solid android:color="#fc9700"/> 
</shape> 

和我的main.xml是

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:gravity="center_horizontal" 
    > 
<LinearLayout 
    android:padding="4dip" 
    android:orientation="vertical" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:background="@drawable/list_bkg_rounded" 
    android:gravity="center_horizontal" 
    > 
<TextView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:text="hello all how are you ? " 
    android:background="@drawable/back_repeat" 
    /> 
</LinearLayout> 
</LinearLayout> 
+0

將在早上嘗試一下,看不出與我的代碼有很大的區別,但你永遠不會知道......謝謝! – Ferdau 2012-03-28 14:24:24