dsa*_*ple 14 java android android-compatibility android-theme
我正在尝试使我的ICS(API级别15)应用程序与Gingerbread(API级别10)兼容,并且我得到InflateException Error inflating class <Unknown>
任何具有?android:attr/
属性的布局XML .如果我注释掉这些属性,我可以编译并运行应用程序,但当然,它看起来很糟糕.
我宁愿不复制android.R.attr
我正在使用的所有项目,但目前我迷失了另一种方式来做到这一点.
我正在使用ActionBarSherlock来使ActionBar正常工作,而我似乎并没有使用任何其他需要支持库的东西(尽管我在尝试解决这个问题的过程中将其包含在内),只是这些主题 - 基础资源,我坚持.
我正在使用的一些主题资源是:
?android:attr/textColorSecondaryInverse
?android:attr/textAppearanceLarge
?android:attr/dividerVertical
?android:attr/selectableItemBackground
?android:attr/textAppearanceMedium
?android:attr/dividerVertical
?android:attr/dividerHorizontal
san*_*tap 12
使用API 11中的样式特别是android:attr/textAppearanceMedium?android:attr/dividerVertical?android:attr/dividerHorizontal
最简单的方法是在您需要的地方使用以下代码
<!-- For Horizontal Line-->
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:layout_marginLeft="4dip"
android:layout_marginRight="4dip"
android:background="#aaa"
android:layout_alignParentTop="true"/>
<!-- For Vertical Line-->
<View
android:id="@+id/VerticalLine"
android:layout_width="1dip"
android:layout_height="wrap_content"
android:layout_marginBottom="4dip"
android:layout_marginTop="4dip"
android:background="#aaa"/>
Run Code Online (Sandbox Code Playgroud)
paw*_*eba 11
正如文档中的一些样式在更高的API中.例如:
dividerVertical
自API 11起dividerHorizontal
自API 11起?
mark用于引用当前主题中的样式.
要解决您的问题,您可以:
values-v11
在values
使用自定义值或旧API的不同属性时,将它们放入文件夹并支持旧版本的样式.这取决于你的目标.当本机应用程序对您很重要时,第一个建议是有意义的.
如果你想在任何地方都拥有Holo风格,那么就没有办法复制它并将其用作所有平台的一种风格.
看看这个项目:https://github.com/Prototik/HoloEverywhere
归档时间: |
|
查看次数: |
11135 次 |
最近记录: |