2012-03-28 121 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