Reputation: 4126
first please check this image:
It shows an Spinner beautiful and nice, my Spinner looks like that:
Here is all my source code.
Activity xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="amaz1ngc0de.com.br.spinnertest.MainActivity">
<Spinner
android:id="@+id/sp_paymentType"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</Spinner>
</RelativeLayout>
My question is: How can I achieve the same layout showed at tutorial?
PS: I have checked this topic: Correct usage of a Spinner, following material design guidelines it says something about themes, but I can't make it work, and the tutorial I'm following is that one: Spinners
Upvotes: 3
Views: 875
Reputation: 11044
Your tutorial is quite dated, unfortunately. The first screenshot you're showing is in the Holo style. What you've created uses the newer and better Material Design. Good job, you bested the tutorial!
However, if you really wanted to achieve the same effect, you can go backwards to the old look, by setting your activity to use the Holo theme. You can do that in your AndroidManifest.xml
:
<activity
android:name="..."
android:theme="@android:style/Theme.Holo.Light" />
Or if you are using your custom theme then set is a parent:
<style name="AppTheme" parent="android:Theme.Holo.Light">
If you want to change the look of just the Spinner
, not the whole screen, you can use android:theme
on your Spinner
:
<Spinner
android:id="@+id/sp_paymentType"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:theme="@android:style/Theme.Holo.Light">
Upvotes: 7