Android Question Overriding themes in manifest file for spinner

Discussion in 'Android Questions' started by techgreyeye, Oct 4, 2018.

  1. techgreyeye

    techgreyeye Member Licensed User

    Hi All,

    I have just started trying to target my app builds to newer version of Android in order to put them on Google Play, previously they were targeted at sdk 4. This has caused my apps to change appearance, so I trying to get them looking how I want using themes and overriding where necessary.

    My manifest file is currently:

    AddManifestText(
    <uses-sdk android:targetSdkVersion="26"/>
    <supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
    SetApplicationAttribute(android:icon, "@drawable/icon")
    SetApplicationAttribute(android:label, "$LABEL$")
    SetActivityAttribute(main, android:windowSoftInputMode, adjustResize|stateHidden)
    SetActivityAttribute(ViewFile, android:windowSoftInputMode, adjustResize|stateHidden)
    SetActivityAttribute(Keyboard, android:windowSoftInputMode, adjustResize|stateHidden)
    AddPermission("android.permission.VIBRATE")
    SetApplicationAttribute(android:theme, "@style/DarkTheme")
    CreateResource(values-v20, theme.xml,
    <resources>
    <style
    name="DarkTheme" parent="@android:style/Theme.Material">
    <item name="android:textColor">#FFFF00</item>
    </style>
    </resources>
    )
    CreateResource(values-v14, theme.xml,
    <resources>
    <style
    name="DarkTheme" parent="@android:style/Theme.Holo">
    </style>
    </resources>
    )


    So that's great, I can set the default text color, but I can't work out how to set the background and text colors of a spinner, or any other individual item.

    Is there any information on this anyone can point me to? Or is my approach (editing the manifest) wrong and I should be doing something else?

    Thank you,

    Darren
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Please use [code]code here...[/code] tags when posting code.

    Why aren't you using CreateResourceFromFile?

    Change the Spinner colors with Spinner.DropdownBackgroundColor and DropDownTextColor.
     
    Peter Simpson likes this.
  3. techgreyeye

    techgreyeye Member Licensed User

    Hi Erel,

    Thanks for the response.

    I'm not using CreateResourceFromFile because I didn't know about it. Everything I have done so far is from examples picked up on the forums here. I will look it up.

    I've worked out the following, which I assume is correct and seems to work.
    Code:
    CreateResource(values-v20, theme.xml,
    <resources>
        <style
           name=
    "DarkTheme" parent="@android:style/Theme.Material">
        <item name=
    "android:textColor">#FFFF00</item>
        <item name=
    "android:spinnerItemStyle">@style/SpinnerItemTheme</item>
        </style>
    </resources>
    )
    CreateResource(values-v20, styles.xml,
    <resources>
           <style name=
    "SpinnerItemTheme"
                parent=
    "android:TextAppearance.Widget.TextView.SpinnerItem">
             <item name=
    "android:textColor">#FFF</item>
        </style>
    </resources>
    )

    I just need to use CreateResourceFromFile ...
     
    DonManfred likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice