CQM*_*CQM 70 android android-xml android-support-library
即使我的应用程序中包含android支持v7
加入
android:background="?android:attr/selectableItemBackground"
使我的IDE,Eclipse抛出错误(阻止我编译),通知我selectableItemBackground仅适用于最小Api 11及以上.
如何将此属性添加到XML中的背景?
假设从较高的库复制和粘贴不是解决方案
Vik*_*ram 204
由于属性是在库(支持v7)中定义的,因此您可以将其用作用户定义的属性:即没有android:前缀:
android:background="?attr/selectableItemBackground"
Run Code Online (Sandbox Code Playgroud)
您看到的错误指出?android:attr/selectableItemBackground可用于API版本> = 11.确实如此.
Sun*_*nny 16
这是selectedItemBackground.您可以在/platforms/android-14/data/res/themes.xml中找到它
<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_window_focused="false" android:drawable="@color/transparent" />
<!-- Even though these two point to the same resource, have two states so the drawable will invalidate itself when coming out of pressed state. -->
<item android:state_focused="true" android:state_enabled="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_disabled" />
<item android:state_focused="true" android:state_enabled="false" android:drawable="@drawable/list_selector_background_disabled" />
<item android:state_focused="true" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
<item android:state_focused="false" android:state_pressed="true" android:drawable="@drawable/list_selector_background_transition" />
<item android:state_focused="true" android:drawable="@drawable/list_selector_background_focused" />
<item android:drawable="@color/transparent" />
</selector>
Run Code Online (Sandbox Code Playgroud)
你可以在Android SDK目录中找到drawables
../platforms/android-14/data
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
69868 次 |
| 最近记录: |