随笔分类 -  Android

Tab添加左右按钮
摘要:效果图 主要是在自定义tabHost添加两个按钮,这个定义方法与普通的定义相同,这里就不再说明了。xml布局: 1 <LinearLayout 2 android:orientation="horizontal" 3 android:layout_width="fill_parent" 4 android:layout_height="wrap_content" 5 > 6 <ImageButton 7 android:id="@+id/left" 8 android:layout_height= 阅读全文
posted @ 2012-06-04 20:32 月vs枫 阅读(1231) 评论(0) 推荐(0)
WebView个人总结
摘要:1、添加上网权限:<uses-permission android:name="android.permission.INTERNET" />2、设置webview 1 WebView webView; 2 WebSettings ws; 3 4 5 ws = webView.getSettings(); 6 ws.setAppCacheEnabled(true);// 设置启动缓存 7 ws.setAppCacheMaxSize(1024 * 10);// 设置最大缓存 8 ws.setSupportZoom(true);// 设置成拖动放大缩小 9 ws.s 阅读全文
posted @ 2012-05-31 08:41 月vs枫 阅读(4359) 评论(2) 推荐(1)
解决android客户端显示中文乱码问题
摘要:1 HttpResponse httpResponse = httpclient.execute(httppost);2 int statusCode = httpResponse.getStatusLine().getStatusCode();3 if(statusCode==HttpStatus.SC_OK)4 {5 //获得返回结果6 response =EntityUtils.toString(httpResponse.getEntity(),"UTF... 阅读全文
posted @ 2011-12-16 16:57 月vs枫 阅读(1004) 评论(0) 推荐(0)
【原创】在Android系统下实现抓词
摘要:对于TextView显示的内容,通过点击屏幕,就能把当前显示的内容获取出来。以下的例子是通过判断空格来区分每个词,对于英文单词是适用的,如果想抓中文就得自己想办法了,当然也可以改变判断来抓词。 实现代码主码有TextPaint paint = text.getPaint(); float x, y; String str = text.getText().toString().replace(",", " ").replace("-", " "); String temp = " "; x = 阅读全文
posted @ 2011-07-12 11:33 月vs枫 阅读(430) 评论(1) 推荐(0)
自定义ImageButton,实现快进快退功能
摘要:具体做法是仿照系统的RockAudioPlayer,我也是通过查看源码,然后把它简化出来,更容易于应用。通过自定义一个RepeatingImageButton,当然这个名字可以自己更改,RepeatingImageButton里的代码可以查看RockAudioPlayer的源码,我这里只给出经过简化过的java代码。 1 public class MainActivity extends Activity { 2 /** Called when the activity is first created. edit by etgyd*/ 3 private RepeatingImageBut. 阅读全文
posted @ 2011-04-12 15:50 月vs枫 阅读(807) 评论(0) 推荐(0)
弹出小窗口,PopupWindow的使用
摘要:在程序里弹出一个小窗口,像系统的MediaController一样,具体做法:先在mail.xml的layout布局里加一个id,这个到后面会用到的,1 <?xml version="1.0" encoding="utf-8"?>2 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"3 android:orientation="vertical"4 android:layout_width="f 阅读全文
posted @ 2011-04-08 17:41 月vs枫 阅读(15448) 评论(5) 推荐(2)
调用系统的媒体音量控制显示
摘要:调大声:1 AudioManager audioMa=(AudioManager)this.getSystemService(Context.AUDIO_SERVICE);2 audioMa.adjustStreamVolume(AudioManager.STREAM_MUSIC,AudioManager.ADJUST_RAISE,AudioManager.FX_FOCUS_NAVIGATION_UP);调小声:1 AudioManager audioMa=(AudioManager)this.getSystemService(Context.AUDIO_SERVICE);2 audioMa. 阅读全文
posted @ 2011-04-08 17:24 月vs枫 阅读(483) 评论(0) 推荐(0)
解决SurfaceView有声音没图像的情况【转】
摘要:使用SurfaceView播放视频,其实很简单,但是经常会碰见有声音没图像的问题.其实使用SurfaceView播放视频只需要主要下面几个地方就可以了1. surfaceChanged也就是Suface是否创建成功2. onPrepared 也就是MideoPlayer是否加载并准备完成3. surfaceHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); 类型必须是SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERSjava代码: 1 package VideoTest.Test; 2 3 import 阅读全文
posted @ 2011-04-07 14:56 月vs枫 阅读(6719) 评论(0) 推荐(0)
android颜色对应的xml配置值
摘要:<?xml version="1.0" encoding="utf-8" ?> <resources> <color name="white">#FFFFFF</color><!--白色 --> <color name="ivory">#FFFFF0</color><!--象牙色 --> <color name="lightyellow">#FFFFE0</color>< 阅读全文
posted @ 2011-04-02 17:13 月vs枫 阅读(4886) 评论(2) 推荐(5)
自定义TabHost
摘要:public class MainActivty extends Activity { /** Called when the activity is first created. */public TabHost tabHost; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); tabHost=(TabHost)findViewById(R.id.TabHost01); tabHost.s 阅读全文
posted @ 2011-03-30 15:35 月vs枫 阅读(3426) 评论(0) 推荐(0)