Is it possible to make an EditText in android 2.x that looks like an EditText from Android 4?

后端 未结 2 463
鱼传尺愫
鱼传尺愫 2021-01-23 09:53

Is it possible to make an EditText in android 2.x that looks like an EditText from Android 4? I mean blue backlight with flanged edges below.

相关标签:
2条回答
  • 2021-01-23 10:44

    Yes there is a library called holoeverywhere, you'll get all 4.2 components in 2.1+:

    https://github.com/ChristopheVersieux/HoloEverywhere

    0 讨论(0)
  • 2021-01-23 10:51

    If you don't want to use an external library you can use the following code:

    add the below code to res\values\styles.xml

    <style name="HoloEditText">
        <item name="android:background">@drawable/edit_text_holo_dark</item>
    </style>
    

    After that from YOURPATH\android-sdk\platforms\android-16\data\res\ just copy the edit_text_holo_dark.xml and all referenced drawables to the corresponding directories in your project.

    And then simply apply the style to your EditText:

     <EditText
       android:id="@+id/editText"
       style="@style/HoloEditText"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"/>
    
    0 讨论(0)
提交回复
热议问题