0

Hi I am trying to style several buttons in one menu with the same size and shadow, I found code here How to provide shadow to Button to help me do this but I want each button to have a different background image but as I am already calling this style using android:background="@anim/button_menu" I cannot change the background of each button by saying android:background="@drawable/imageclassroom" as background has already been called. Any help on how to overcome this issue would be great

Community
  • 1
  • 1
Alan Mc
  • 7
  • 5

1 Answers1

1

use this tyep make a color button

 <Leniarlayout
 android:layout_width="match_parent"
 android:layout_hight ="40dp"
 android:background ="#000"
 android:padding ="5dp">

 <Button
 android:id="@+id/angry_btn"
 android:text="Button"
 android:textColor="#FFFFFF"
 android:textSize="30sp"
 android:layout_width="270dp"
 android:layout_height="60dp"
 android:background="@drawable/(set image path)"
 android:shadowColor="#A8A8A8"
 android:shadowDx="0"
 android:shadowDy="0"
 android:shadowRadius="5"
 />
 </Leniarlayout>
Jai
  • 486
  • 1
  • 8
  • 21
  • thats cool but doesn't solve my problem, I am trying to apply a style to several buttons but also change the background of each button so that they all look different – Alan Mc Mar 18 '15 at 11:08
  • what type of style u want – Jai Mar 18 '15 at 11:11
  • all buttons should have curved corners with a shadow behind them and shadow behind the text, then each button will have a different image as the background – Alan Mc Mar 18 '15 at 11:15
  • all you are saying is great except I don't know how to set the button background as an image – Alan Mc Mar 18 '15 at 11:39
  • android: background = "@drawable/image.file – Jai Mar 18 '15 at 12:22
  • yes but I cant use that and andorid:background="drawable/ the xml file as there is two android:background which is not allowed – Alan Mc Mar 18 '15 at 12:24
  • edit your image in use Photoshop customize size example :60x30 pixel – Jai Mar 18 '15 at 12:24
  • btn backgroud using image file k shadow btn using put the bellow code in button android:shadowColor="#A8A8A8" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="5" – Jai Mar 18 '15 at 12:28
  • What you are saying adds the shadow to the text in the button not the other edge of the button – Alan Mc Mar 18 '15 at 12:32
  • Yes that adds shadow to the text I want shadow on the outside of the button not the text just the button – Alan Mc Mar 18 '15 at 13:04
  • use above code create linear-layout set shadow background on linear-layout put button on linear-layout – Jai Mar 18 '15 at 13:09