Why are my button styles different - xaml vs programmatic - android

I'm playing around with Xamarin, building an Android app for my own amusement. For some reason Buttons added to the xaml are square (e.g. "Play") but ones that I add programmatically are round (e.g. "P").
What's going on there? How do I make the programmatically added buttons consistent with the ones defined in the xaml?

Related

Does elevation not work within Android Home Screen Widgets?

Tried all sorts of different ways to do this but not matter what view I apply an elevation to (such as android:elevation="10dp") it does not render correctly on a Home Screen Widget.
Is this a known limitation, that home screen widgets do not support elevation. I am running this on an Android L device so its should not be a compatibility issue.
If this is impossible I figure I could use 9-patch or layer-list drawable to achieve a similar but not as good effect.
I've played with all widgets I have on my phone (both with Nova Launcher and Nexus 5 stock launcher, which is Google) and none of them have this feature, even Google apps (excluding Google Now!).
I've added app:elevation="10dp" on my widget and I think that it is not possible to have this feature on Widget directly, without playing with code and fantasy.
If you really want a widget that include elevation design, just "copy" the style of Google Now widget.
I suppose that they have a transparent layout (the black parts on image) wich contains another layout (grey) with elevation and grid filled with CardView with elevation too.
Let me know if you want an example code.

Android XML Drawable Windows Phone 8 Equivalent

I have an Android app that uses a lot of XML drawables (shapes, layer lists, and state list), and I want to port this app to Windows Phone 8. Is there an equivalent to XML drawables (specifically the types I list above) in Windows Phone 8?
For layer lists and state list i think the equivalent is VisualStates but they are not so similar. Define different visual states for a control, You can find many different examples to VisualState's here inside a VisualState you gave different properties different values (such as different Image to background of a button when pressed) or define animations.
For shapes there are classes that you can define in your xaml file. If you want to define a gradient should look at brushes.

Android dialog activity frame as template

I've got a handful of configuration dialogs in my app, and they all have Cancel/OK buttons at the bottom. Now, in API level 11 and up, I want to show Cancel on the left and OK on the right, and also use the ButtonBar style. In API levels 10 and lower I want to show floating buttons, with OK on the left.
Presently I have copies of the XML layouts in both my layout and my layout-v11 folder, with nothing different between them but the button area. However these layouts are fairly complex and I'm trying to save some space, so it would really be better to just have one copy of each layout, and just snap the layouts into a template with the correct button style on the bottom. What would be the best way to go about this? Fragments?
Why not do just the button swap programatically? You can find the build version codes from SDK_INT and swap the PositiveButton and NegativeButton based on the SDK versions.
If you have the layouts in the xml files and cannot be done in the code for some reasons, you have just the buttons in two different layouts and use the merge tag

How to make customised android button shown in the below image?

By using css or jquery it's easy to bring this grouped buttons. But in android native application how to design a xml file to bring grouped buttons like this, without using tabWidget method (i.e)tab layout.
That's a segmented radio button. There are various solutions but this is a good one: https://github.com/makeramen/android-segmentedradiobutton

Change colour scheme of phone specific UI elements (Selected Buttons / Selected EditText)

I'm working on a Nexus S and the phone theme uses Black and Orange. I started with a custom button - changing the background from #android:drawable/btn_default to my own 9 Patch image. This is fine and dandy and there are 100's of tutorials and examples of such littering Google.
The problem is I don't want to create a different style of button. I want the UI in my app to as insofar as possible to stay true to the phones own buttons and UI elements. What I want is to create a custom button which looks exactly like android:state_pressed="true" and android:state_focused="true" but instead of orange, blue.
I also want to do this for selected EditText & Spinners and the like.
Am I doomed to backwards engineer each element, guessing each pixel, one for each state and create 9 patch images of them? That's what I've done below for the blue button - as you can see, close but not exact.
Has android given these buttons out somewhere - if that was true it would take an afternoon but it wouldn't be unreasonable to create the same UI set in a different colour.
Or is the a programmatic way of saying "For this app use this theme" that I've just never heard of (Big ask).
If you look in the Android SDK folder under platforms you will see all of the different SDk levels that you have downloaded. Inside each there is a data/res/drawable folder where there are all of the images used in the UI. You can modify those and add them to your own resources. But yes, any change you want to make to the default UI you will need to implement yourself.

Categories

Resources