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

安稳与你 提交于 2019-12-02 09:08:00

问题


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.


回答1:


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

https://github.com/ChristopheVersieux/HoloEverywhere




回答2:


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"/>


来源:https://stackoverflow.com/questions/13821395/is-it-possible-to-make-an-edittext-in-android-2-x-that-looks-like-an-edittext-fr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!