Phil
Phil

Reputation: 213

Porting project from Eclipse to Android Studio changes style of buttons

I have switched from Eclipse to Android Studio. Since an import of my Eclipse-Project didn't work, I created a new project in Android Studio and copied the files one after the other. I got the project to work but now I am facing some strange behaviour. On an XperiaZ with Android 5.0.2 the text of my buttons is written in uppercase letters (it isn't like this if I build the project in Eclipse). If I install the application on a Samsung Galaxy S4 with Android 4.4.2 the layout gets very strange. I have some buttons which I colour on my onCreate-method by using

 myButton.getBackground().setColorFilter(GREEN,
            PorterDuff.Mode.MULTIPLY);

This works fine on the XperiaZ as well as on the S4 if I build the project with Eclipse, but if I build the project with Android Studio, the buttons are grey on the S4. On the XperiaZ they are coloured. If I press the button, the correct colour is set for short time but then disappears again (note that I also change the colour in the onClick-method.

I already tried different styles, but it didn't help. Does anybody have an explanation for this behaviour, or an idea what I could try to fix this problem?

Upvotes: 0

Views: 86

Answers (1)

Phil
Phil

Reputation: 213

I figured it out by myself. The problem was I used an Appcompat theme. I had to use it because my Activity was extending AppCompatActivity (this was set by default when I created the project). I had to change it to myActivity extends Activity so I could use a "normal" android Theme. I just don't know why it did work with Eclipse and with the XperiaZ...

Thanks to @Selvin and @adelphus for the hints in the right direction.

Upvotes: 1

Related Questions