我正在使用微调器并想添加微调器 - 改变行为取决于状态(聚焦,按下)
示例项目在这里https://github.com/vovs/spinner_issue
我的代码:
activity_main.xml中
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:spinnerMode="dropdown"
android:dropDownSelector="@drawable/spinner_state" />
Run Code Online (Sandbox Code Playgroud)
spinner_state.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="false"
android:drawable="@color/black" />
<item
android:state_pressed="true"
android:state_enabled="true"
android:drawable="@color/red" />
<item
android:state_focused="true"
android:state_enabled="true"
android:drawable="@color/red" />
<item
android:state_enabled="true"
android:drawable="@color/gray" />
</selector>
Run Code Online (Sandbox Code Playgroud)
AndroidManifest:
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />
Run Code Online (Sandbox Code Playgroud)
所以,如果我在模拟器Android 4.0.2 API 14中运行app并尝试选择一些项目或使用鼠标滚轮滚动没有任何效果,我在选择器中设置(当按下或滚动时 - 项目应该是红色的,但它是蓝色 - ICS颜色的默认值).
对于Android 2.2 API 8,当使用滚轮按下或滚动时(在这种情况下状态为聚焦)颜色为黄色[橙色](Android 2.2的默认颜色)
如何为微调器启用选择器?

我在我的应用程序中使用了chrisbanes的Android-PullToRefresh.
我需要禁用第一次片段启动时的pulltorefresh功能 - 当列表为空并且项目在后台下载时.在这种情况下(列表为空),用户可以向下滑动,并显示"Release to refresh"的进度条.
加载所有项目后,我想启用pulltorefresh功能..
怎么样?
已升级应用程序以使用 Material Design - Theme.AppCompat.Light.NoActionBar、Toolbar而不是ActionBar等。
并且有问题。在 API >= 21 的设备上,底部内容隐藏在软导航栏(见下图)下
已找到解决此问题的解决方案:
在values-v21/styles.xml
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
...
<item name="colorPrimaryDark">@color/green</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
</styles>
Run Code Online (Sandbox Code Playgroud)
如果选项<item name="android:windowDrawsSystemBarBackgrounds">false</item>- 底部内容可见,但状态栏变为完全黑色。我无法将颜色更改为colorPrimaryDark(在我的情况下为绿色)
如果选项<item name="android:windowDrawsSystemBarBackgrounds">true</item>- 底部内容不可见,并且状态栏为绿色,正如预期的那样。
我想要状态栏颜色(绿色)和可见的底部内容.. 可能,问题在于工具栏。它是否将内容向下推?
有什么建议?
<item name="android:windowDrawsSystemBarBackgrounds">true</item>

<item name="android:windowDrawsSystemBarBackgrounds">false</item>

更新:
正如@azizbekian 所建议的,我已经将 Fragmet 的容器替换为 CoordinatorLayout(在 FrameLayout 之前)并应用android:fitsSystemWindows="true"
在这种情况下底部面板是可见的,但不是在底部......目标是将按钮保持在底部......
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical">
<include
layout="@layout/toolbar"/>
<!-- The main content view -->
<android.support.design.widget.CoordinatorLayout
android:id="@+id/content" …Run Code Online (Sandbox Code Playgroud) android android-layout android-view material-design windowinsets