简体   繁体   English

Android:Theme Holo先前版本

[英]Android: Theme Holo previous version

I really like the 4.0 ICS Holo Light theme and would like to have it in my app to support <4.0 smartphones. 我非常喜欢4.0 ICS Holo Light主题,并希望在我的应用程序中使用它以支持<4.0智能手机。

I found Android layoutlib.jar in platform folder but its 8mb!!! 我在平台文件夹中找到了Android layoutlib.jar,但它的大小为8mb! and I really don't have afford to increase my app with 8mb. 而且我真的没有能力将我的应用程序增加8mb。 Any tip? 有小费吗?

//Pew Labs PS ive tried https://github.com/ChristopheVersieux/HoloEverywhere but it doesnt support TabVIew which I use // Pew Labs PS ive尝试过https://github.com/ChristopheVersieux/HoloEverywhere,但它不支持我使用的TabVIew

Thanks! 谢谢!

It would be better not to use the Holo theme on unsupported devices. 最好不要在不受支持的设备上使用Holo主题。 You can do a simple trick to make your app run the Holo theme on 3.x and up, and one of the built in themes on 2.3 and below, like so: 您可以做一个简单的技巧,使您的应用程序在3.x及更高版本上运行Holo主题,并在2.3及以下版本上运行内置主题之一,如下所示:

  1. In your manifest, use this line for your activity's theme 在清单中,将此行用作活动的主题

    android:theme="@style/Theme.MyTheme" android:theme =“ @ style / Theme.MyTheme”

  2. In your res/values folder put a styles.xml file, containing 在res / values文件夹中放入一个styles.xml文件,其中包含

     <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.MyTheme" parent="@android:style/Theme.Black" /> </resources> 
  3. Create a res/values-v11 folder, and a styles.xml file in that, containing: 创建一个res / values-v11文件夹,并在其中创建一个styles.xml文件,其中包含:

     <?xml version="1.0" encoding="utf-8"?> <resources> <style name="Theme.MyTheme" parent="@android:style/Theme.Holo" /> </resources> 

This will make Android use the Holo theme if the app is running on a device that supports it (3.x and up, which is API level 11 and up, hence the "values-v11"). 如果应用程序在支持它的设备(3.x及更高版本,即API级别11及更高版本,因此为“ values-v11”)上运行,这将使Android使用Holo主题。 This is the best solution to make your app match the phone's user interface, and use the Holo theme only wherever it's supported. 这是使您的应用程序与手机的用户界面匹配,并且仅在受支持的地方使用Holo主题的最佳解决方案。

Check ActionbarSherlock . 检查ActionbarSherlock It also provides a styled TabView. 它还提供了样式化的TabView。 The samples directory provides a real good example for a TabView which works like a charm on Android 2.2. 示例目录为TabView提供了一个很好的示例,它在Android 2.2上像超级按钮一样工作。

You can use Holo in Android 2.3< with this simple library : http://www.holoeverywhere.com/ Its called Holo everywhere and works fine in previous versions of android. 您可以通过以下简单的库在Android 2.3中使用Holo: http : //www.holoeverywhere.com/在任何地方都称为Holo,并且在以前的android版本中可以正常工作。 The Library is hosted on Github . 该图书馆托管在Github上

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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