android Theme.Holo.Dialog changing blue lines to orange

前端 未结 3 1445
生来不讨喜
生来不讨喜 2021-01-31 03:46

Default color for lines on Android theme Theme.Holo.Dialog are blue. I\'d like to know how to change this to any other color. Orange in my case.

I can change text or back

相关标签:
3条回答
  • 2021-01-31 03:57

    Just dug around in the source for you - unfortunately the Divider line in the dialog layouts is a view with a hard coded color background that doesn't reference any themes:

    <View android:id="@+id/titleDividerTop"
      android:layout_width="match_parent"
      android:layout_height="2dip"
      android:visibility="gone"
      android:background="@android:color/holo_blue_light" />
    

    So if you want to change the color you'll have to layout your own, custom, dialog box. to make it easier, it wouldn't hurt to just copy from the android source base and customize it to your needs, but you might also get a lot more than you need.

    0 讨论(0)
  • 2021-01-31 04:10

    There is a library which does exactly what you need - easy styling of dialogs in Holo theme:

    https://github.com/inmite/android-styled-dialogs

    0 讨论(0)
  • 2021-01-31 04:13

    one trick is using dialog with no title bar, hence android not draw the line, then adding title and the line yourself in dialog`s layout xml file! for example:

    <style name="myDialogStyle" parent="android:style/Theme.Holo.Dialog">
        <item name="android:windowNoTitle">true</item>
    </style>
    

    in manifest use:

        <activity
            android:name=".Activity.Mydialog"
            android:theme="@style/myDialogStyle" >
        </activity>
    

    and in your Mydialog layout define title and line yourself with your desired color and style!

    cheers!

    0 讨论(0)
提交回复
热议问题