![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
android案例
文章平均质量分 83
bug_lover_liao
逐梦北京实习中。。。
展开
-
SQLiteOpenHelper使用之英文生词本
界面效果如下: 布局代码如下: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:l原创 2016-09-10 10:25:09 · 1159 阅读 · 0 评论 -
ViewPager+FragmentPagerAdapter+TabPageIndicator实现Tab效果(推荐)
编写布局文件代码: activity_main.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:or原创 2016-10-04 20:59:17 · 516 阅读 · 0 评论 -
ActionBar结合Fragment实现Tab导航
第一步:给出布局文件如下: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horiz原创 2016-09-17 16:12:13 · 563 阅读 · 0 评论 -
fragment实现Tab效果
使用下面两句代码获取对fragment的事务处理: FragmentManager fm = getSupportFragmentManager(); FragmentTransaction transaction = fm.beginTransaction();使用FrameLayout来显示fragment, 通过transaction.add(int framelayou原创 2016-10-04 16:55:43 · 299 阅读 · 0 评论 -
android屏幕捕捉
使用MediaprojectionManager 的方法来进行屏幕捕捉,VirtualDisplay来展示捕捉的屏幕截图,关键代码为: 实例化视频放映管理器 projectionManager = (MediaProjectionManager) getSystemService( Context.MEDIA_PROJECTION_SERVICE); 通过startAct原创 2016-09-26 21:36:16 · 2026 阅读 · 0 评论 -
android录制视频实现
Android视频录制使用MediaRecorder来录制,SurfaceView来预览视频 与录制音频类似,录制视频的步骤为: 1. 构造MediaRecorder对象 2. 设置视频的声音和视频来源 3. 设置视频文件的输出格式 // 3必须在4 之前 4. 设置视频图像的编码格式 5. 设置保存到文件 6. 使用SurfaceView预览视频 7原创 2016-09-26 21:19:52 · 2155 阅读 · 0 评论 -
Notification的功能与使用案例
Notification的主要方法的使用和解释见代码: public class NotificationActivity extends Activity implements View.OnClickListener{ private Button send,cancel; private NotificationManager nm; // 定义一个Notific原创 2016-09-21 19:28:02 · 355 阅读 · 0 评论 -
SearchView的功能与使用
搜索框组件SearchView常与Listview配合使用,实现搜索提示,使用方法和解释见代码,功能效果如下: 界面代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout原创 2016-09-21 19:21:29 · 503 阅读 · 0 评论 -
使用MediaPlayer和SurfaceView结合播放视频
2原创 2016-09-24 21:09:52 · 1136 阅读 · 0 评论 -
SoundPool的使用案例
相比于MediaPlayer, SoundPool的优点有: 1. 所需的资源量较小,反应的延迟也更小 2. 支持多个音频同时播放 3. 可自行设置音频的品质,播放比率等参数 SoundPool适用于播放短而密集的音频 SoundPool主要有load()方法和play方法: int play(int soundId, float leftVolume, float rightV原创 2016-09-24 18:58:14 · 369 阅读 · 0 评论 -
VideoView使用案例
VideoView使用代码: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <VideoView andro原创 2016-09-24 19:37:45 · 421 阅读 · 0 评论 -
SD卡文件浏览器案例
布局文件如下: <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=原创 2016-09-08 17:00:16 · 855 阅读 · 0 评论 -
ActionBar下拉式导航
第一步:编写布局文件: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizon原创 2016-09-18 14:40:38 · 288 阅读 · 0 评论 -
android开发桌面控件之液晶时钟
第一步:新建一个led_clock.xml文件,用来写时钟的布局,我们用6个ImageView存放时钟的时、分、秒的数字图像,代码和效果如下: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:l原创 2016-09-14 11:39:21 · 2857 阅读 · 0 评论 -
android动态壁纸开发(能运行的)
网上也有讲开发动态壁纸的博客,我在看书编写这个例子时,发现我编写的动态壁纸找不到,后来发现是没有将我编写的WallpaperService跑起来,而书上和有点博客照搬写到是不需要Activity的,我发现没有Activity的话,程序都跑不起。下面讲下我的做法: 第一步:编写LiveWallpaper类继承WallpaperService,代码如下: public class LiveWall原创 2016-09-13 19:27:46 · 8682 阅读 · 2 评论 -
Android UI模板设计案例
目的:设计一个自定义的UI控件,类似Button一样的Android控件。如本案例要设计一个如下的控件: 左边蓝色和右边蓝色部分为两个Button,中间是一个TextView,我们的目的就是要设计出一个这样的控件 第一步:设计控件的各种属性 在values目录下新建一个xml文件,名为attrs.xml:原创 2016-11-01 18:35:38 · 518 阅读 · 0 评论