我在android中的导航抽屉中实现了回收器视图.这样工作正常.我可以通过单击回收器视图项来切换项目.但是我无法改变所选项目的背景颜色.请告诉我如何改进它.到目前为止我已经尝试过了.
1. RecyclerView项目中的背景选择器 试图使回收者视图可点击,可聚焦但不起作用
2. http://innodroid.com/blog/post/tracking-selected-item-in-recyclerview
实现但不明白在哪里编写代码来改变背景
请帮帮我.
java android android-layout android-5.0-lollipop android-recyclerview
我正在开发一个Android应用程序在matrial设计.我正在尝试使用工具栏作为我的应用程序的操作栏.但是当运行应用程序我崩溃并获得错误.
Caused by: java.lang.IllegalStateException: This Activity already has an action bar supplied by the window decor. Do not request Window.FEATURE_ACTION_BAR and set windowActionBar to false in your theme to use a Toolbar instead.
Run Code Online (Sandbox Code Playgroud)
style.xml
<style name="AppTheme" parent="AppTheme.Base" />
<style name="AppTheme.Base" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primaryDarker</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@android:color/white</item>
</style>
<color name="primary">#457C50</color>
<color name="primaryDarker">#580C0C</color>
Run Code Online (Sandbox Code Playgroud)
MianActivity.java
public class MainActivity extends ActionBarActivity {
Toolbar toolbar;
DrawerLayout mDrawerLayout;
FrameLayout mainView; …Run Code Online (Sandbox Code Playgroud) xml android android-layout material-design android-5.0-lollipop