2013-07-15 24 views
0

您好我已經做了一個Android程序,我已經把所有的活動,但我已經應用了一個樣式的單一九個路徑按鈕,但其他活動不同的樣式爲保證金需要......所以。我有我的一種風格,如下所示:所以我可以在同一個style.xml文件中爲同一元素添加另一種樣式? 我的代碼如下:如何在android中應用多個樣式在相同的XML

<style name="button"> 
     <item name="android:layout_width">fill_parent</item> 
     <item name="android:layout_height">wrap_content</item> 
     <item name="android:layout_marginLeft">30dp</item> 
      <item name="android:layout_marginRight">30dp</item> 
     <item name="android:layout_weight">1</item> 
     <item name="android:tag">200</item> 
     <item name="android:padding">7dp</item> 
     <item name="android:textSize">15dp</item> 
     <item name="android:textColor">#f5f0eb</item> 
    </style> 

回答

1

你可以做這樣的事情

<style name="otherButton" parent="button"> 
    <item name="android:layout_marginLeft">50dp</item>  
... 

此風格繼承了從其父風格做一個子風格。您在子樣式中定義的所有內容都會覆蓋以前定義的任何屬性。

+0

Thanxs ..!henrik – jigar

相關問題