"黑科技" - Eclipse使用RecyclerView
来源:互联网 发布:类似snapseed的软件 编辑:程序博客网 时间:2024/04/28 06:34
之所以取名“黑科技”,因为现在主流就是使用Android Studio
,Eclipse主要是用来维护旧项目,还有就是现在想在Eclipse使用新5.+功能真的不方便,我是搞了N遍才OK了的。网上还好少人聊这个?我自己记录一下
拷贝
adt-bundle-linux-x86_64-20140702/sdk/extras/android/support/v7/appcompat
和/opt/adt-bundle-linux-x86_64-20140702/sdk/extras/android/support/v7/recyclerview
到自己目录下project.properties
添加Library
android.library.reference.1=../appcompatandroid.library.reference.2=../recyclerview
values
目录添加colors.xml
,内容如下
<?xml version="1.0" encoding="utf-8"?><resources> <color name="colorPrimary">#67cc26</color> <color name="colorPrimaryDark">#67cc26</color> <color name="colorAccent">#67cc26</color></resources>
values
目录下styles.xml
内容修改为:
<resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name="colorPrimaryDark">@color/colorPrimaryDark</item> <item name="colorAccent">@color/colorAccent</item> </style> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> </style> <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" /> <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" /></resources>
- 新增
values-v21
目录,添加文件styles.xml
,内容如下
<resources> <style name="AppTheme.NoActionBar"> <item name="windowActionBar">false</item> <item name="windowNoTitle">true</item> <item name="android:windowDrawsSystemBarBackgrounds">true</item> <item name="android:statusBarColor">@android:color/transparent</item> </style></resources>
AndroidManifest.xml
内容
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.recyclerviewdemo" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="22" /> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme.NoActionBar" > <activity android:name=".MainActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application></manifest>
变更Theme为android:theme="@style/AppTheme.NoActionBar"
activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_dark" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.recyclerviewdemo.MainActivity" > <android.support.v7.widget.RecyclerView android:id="@+id/recyclerView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /></RelativeLayout>
MainActivity.java
测试内容
@Overrideprotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Log.d("xujie", "AppCompatActivity Success."); RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recyclerView); Log.d("xujie", "RecyclerView Success."); }@Overrideprotected void onResume() { super.onResume(); if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) { View decorView = getWindow().getDecorView(); // Hide the status bar. int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY //// | View.SYSTEM_UI_FLAG_IMMERSIVE // ; decorView.setSystemUiVisibility(uiOptions); }}
示例源码
2 0
- "黑科技" - Eclipse使用RecyclerView
- 黑科技
- 黑科技
- 黑科技
- 《黑科技》
- 如何使用sun的黑科技unsafe?
- eclipse的黑科技之 代码段抽成新方法
- Eclipse使用RecyclerView
- eclipse 中使用 RecyclerView
- 黑科技/隐性科技展望
- debug 黑科技
- CSS 的黑科技
- 汽车座椅中的黑科技
- ACM竞赛黑科技
- 离散化黑科技
- RunTime黑科技
- 黑科技 - 扩栈
- Windows黑科技汇总
- 如何把AChartEngine加载到view视图?
- Android实战简易教程-第七十三枪(拨打、接听电话自动免提)
- 推荐提升 Android 性能的建议
- 输出N个字母的全排列问题
- HTML标签marquee实现滚动效果
- "黑科技" - Eclipse使用RecyclerView
- WebSocket与SpringMVC集成案例
- django项目部署 - 使用MySQL
- json_encode中文unicode的问题
- com组件和一般dll的区别
- bean的一种使用姿势
- Spark 基础 —— Range
- 闪迪打破存储市场格局 加速全闪存存储
- 40条Android开发优化建议