2011-03-19 89 views

回答

9

诀窍是创建另一个视图,其中包含边框的尺寸并将imageView放在旁边...这是一个丑陋的黑客,但我见过它的唯一方法

+0

谢谢 - 是的,这就是我最后做,并能正常工作。 – Dogweather 2011-03-20 04:15:31

0

我知道这是一个老问题 - 但我想我会添加我今天发现的替代方案。

就像丑陋......但也许更简单。

我需要用分隔符在屏幕上创建一个4个图标的条形图。我所做的就是创建一个容器,并在这4个标签内(其中包含一个标签)。我将它们设置为左侧:0,25%,50%和75%。然后我将每个嵌入的宽度设置为24.8%,并将容器的背景颜色设置为我想要的任何颜色。

例子:

<View id="tb1" bottom="0" height="45dp" width="100%" backgroundColor='#99cc33'> 
    <View height="45dp" left="0" width="24.8%" backgroundColor='#363636'> 
     <ImageView width="40dp" image="/images/trip1.png"/> 
    </View> 
    <View height="45dp" left="25%" width="24.8%" backgroundColor='#363636'> 
     <ImageView width="35dp" image="/images/trip2.png"/> 
    </View> 
    <View height="45dp" left="50%" width="24.8%" backgroundColor='#363636'> 
     <ImageView height="40dp" image="/images/trip3.png"/> 
    </View> 
    <View height="45dp" left="75%" width="25%" backgroundColor='#363636'> 
     <ImageView height="35" image="/images/trip4.png"/> 
    </View> 
</View> 

/约翰

0

做一个 “查看” 上面。并使“视图”颜色作为'backgroundColor'

0

另一个丑陋的黑客。在底部放置背景渐变。您必须先指定高度,并且线条不会100%固定,但您不会在设备上注意到它。

"TextField": { height: 44, backgroundGradient: { type: "linear", startPoint: { x: 0, y: 43 }, endPoint: { x: 0, y: 44 }, colors: [ "white", "#ccc" ] } }