简体   繁体   中英

Android OneBusAway - How do I change colors?

I'm not an android develop at all but I've been tasked with updating colors and styles for OneBusAway . Nothing fancy is required. Examples are changing the header area for green to purple or something like make the default grey background color a darker grey color. I figure that I should be able to open the code, change some hex colors, build and be done.

This should all be really simple but I cannot find where the actual colors get set.

For example, take a look at the code below:

<LinearLayout
            android:id="@+id/stop_info"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:background="@drawable/ab_stacked_solid_busbot"
            android:visibility="gone">

I want to change the background color. So, I search for ab_stacked_solid_busbot which leads me to the following:

public static final int ab_stacked_solid_busbot=0x7f020002;

This does not at all look like a style to me. However, it could potentially be a hex or RBA value but can't get it to match the existing app colors.

In styles.xml, I can find the following:

<style name="HeaderItem">
    <item name="android:background">@drawable/ab_stacked_solid_busbot</item>
    <item name="android:padding">4dp</item>
</style>

This still seems like there is a pointer to a style class somewhere with an atual color attached to it.

Can anyone point me in the direction of where I can make these simple color changes.

I believe that line you found is from the generated R.java file. That is an internal id used by the OS to find the drawable image. Take a look in your drawable folders and you should find an image or xml named ab_stacked_solid_busbot . You will need to modify the xml or in your image editor of choice based on the type.

hex color bro.... here

http://www.colorspire.com/rgb-color-wheel/

find the color you want here.... and it will tell you the hex(six digit code) you can set the background directly to the color like so...

android:background="#000000" 

if your knoow the hex or rgb of the color you want u can use the above site to convert from one to the other, otherwise play with it til the color matches and youll have your code

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM