01 2014 档案

摘要:墨迹天气图:这里都是用的android里面的shape实现的,实现起来比较简单,只是在滚动的时候有点小麻烦。。。当我们多个ListView超出了它的父控件LinearLayout的时候,它们每个ListView都会有自己的滚动,这不是我们想要的效果,我开始想在LinearLayout外面再加一层ScrollView,但是这样一来,我们就遇到了ScrollView和ListView和冲突问题,会导致ListView显示不全。借网上代码理解,我们只有固定ListView的高度,让其不自动调整调整,就不会与ScrollView冲突了。代码如下:public void setListViewHeigh 阅读全文
posted @ 2014-01-31 22:25 无忧之路 阅读(2145) 评论(0) 推荐(0) 编辑
摘要:gridView的布局文件:grid_view_item.xml grid_view_item_selector_xml.xmlgrid_view_item_press_shape.xml grid_view_item_shape.xml 注意:在gridView组件中要声明listSelector来覆盖原有的点击颜色效果,还有在gridView中声明该item的背景颜色。 阅读全文
posted @ 2014-01-28 12:23 无忧之路 阅读(2523) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2014-01-26 11:58 无忧之路 阅读(876) 评论(0) 推荐(0) 编辑
摘要:覆盖activity下的两个方法: @Override public boolean onCreateOptionsMenu(Menu menu) { new MenuInflater(this).inflate(R.menu.option_menu_main, menu); return super.onCreateOptionsMenu(men... 阅读全文
posted @ 2014-01-19 00:30 无忧之路 阅读(3516) 评论(0) 推荐(0) 编辑
摘要:package com.example.fragmentNavigation2.fragment;import android.os.Bundle;import android.support.v4.app.Fragment;import android.view.*;import android.widget.Button;import android.widget.Toast;import com.example.fragmentNavigation2.R;public class WeiXinFragment extends Fragment { private Button bu... 阅读全文
posted @ 2014-01-19 00:28 无忧之路 阅读(1873) 评论(0) 推荐(0) 编辑
摘要:@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.wei_xin_fragment, container, false); button = (Button) view.findViewById(R.id.press_button); regist... 阅读全文
posted @ 2014-01-18 22:41 无忧之路 阅读(1463) 评论(0) 推荐(0) 编辑
摘要:package com.example.fragmentNavigation2.fragment;import android.content.Context;import android.os.Bundle;import android.support.v4.app.Fragment;import android.support.v4.app.FragmentManager;import android.support.v4.app.FragmentPagerAdapter;import android.support.v4.view.ViewPager;import android.vie 阅读全文
posted @ 2014-01-18 00:45 无忧之路 阅读(3647) 评论(0) 推荐(0) 编辑
摘要:@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); final Context contextThemeWrapper = new ContextThemeWrapper(getActivity(), com.viewpagerindicator.R.style.Theme_PageIndicatorDefaults); ... 阅读全文
posted @ 2014-01-17 23:38 无忧之路 阅读(4765) 评论(0) 推荐(0) 编辑
摘要:package com.example.keKuoZhanLieBiao;import android.app.ExpandableListActivity;import android.os.Bundle;import android.view.LayoutInflater;import android.view.View;import android.view.ViewGroup;import android.widget.*;public class MyActivity extends ExpandableListActivity { String[] groups = {" 阅读全文
posted @ 2014-01-12 19:41 无忧之路 阅读(476) 评论(0) 推荐(0) 编辑
摘要:在ListView的xml文件中添加这个属性:android:cacheColorHint="#00000000" 阅读全文
posted @ 2014-01-12 16:08 无忧之路 阅读(184) 评论(0) 推荐(0) 编辑
摘要:TabActivity的局限性 是否还有存在的必要性 其实谷歌有此举动,我们也应该早就想到了,为什么会这么说呢?那就要从TabActivity的原理开始说起了。 做个假定先: 比如我们最外面的Activity是MainActivity, 第一个tab是FirstActivty, 第二个tab是SecondActivity。相信大家都用过TabActivity, 它是一个特殊的Activity,它特殊的地方在哪里?有以下几点为证: 它看起来违反了Activity的单一窗口的原则。因为它可以同时加载几个activity, 当用户点击它上面的tab时,就会跳到相应的Activity上面去... 阅读全文
posted @ 2014-01-11 23:24 无忧之路 阅读(301) 评论(0) 推荐(0) 编辑
摘要:在value文件夹下添加style.xml 再在layout文件夹下定义自定义标题的xml: 然后在这个activity中按以下顺序定义: super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_CUSTOM_TITLE); setContentView(R.layout.maintabs); getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,... 阅读全文
posted @ 2014-01-11 22:37 无忧之路 阅读(575) 评论(0) 推荐(0) 编辑
摘要:在activity中改变标题栏的标题是调用setTitle()方法,参数为标题名称。而tabActivity跟Activity是一样的,因此在onCheckedChanged()方法中要动态改变标题的话,就在逻辑中调用setTitle()方法 阅读全文
posted @ 2014-01-11 22:03 无忧之路 阅读(1143) 评论(0) 推荐(0) 编辑
摘要:import android.app.Activity;import android.app.ProgressDialog;import android.os.Bundle;public class MyActivityTest extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final ProgressDialog progressDialog = new Progress... 阅读全文
posted @ 2014-01-10 14:05 无忧之路 阅读(252) 评论(0) 推荐(0) 编辑
摘要:startService()方法开启一个服务。服务只会开启一次,如果服务已经创建,并且没有销毁,多次调用startService方法只会执行onStartCommand方法和onStart方法。服务停止:1.stopService()2.手动在程序管理器上关闭。 阅读全文
posted @ 2014-01-04 16:46 无忧之路 阅读(3056) 评论(0) 推荐(0) 编辑
摘要:发送自定义广播程序:布局文件: activity.java:import android.app.Activity;import android.content.Intent;import android.os.Bundle;import android.view.View;public class MyActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ... 阅读全文
posted @ 2014-01-04 13:35 无忧之路 阅读(2050) 评论(0) 推荐(0) 编辑
摘要:安装文件与运行环境的skd不匹配 打开源码目录下的AndroidManifest.xml文件,然后注释掉或者删除掉这行: 阅读全文
posted @ 2014-01-03 11:55 无忧之路 阅读(724) 评论(0) 推荐(0) 编辑
摘要:下载并安装小米手机助手它会自动帮你安装驱动程序安装成功后重启一下adb服务应该就可以了 阅读全文
posted @ 2014-01-03 11:48 无忧之路 阅读(1512) 评论(0) 推荐(0) 编辑
摘要:利用广播实现ip拨号布局文件: activity:package com.heyiyong.ipdial;import android.app.Activity;import android.content.Context;import android.content.SharedPreferences;import android.os.Bundle;import android.view.View;import android.widget.EditText;public class MyActivity extends Activity { E... 阅读全文
posted @ 2014-01-02 20:42 无忧之路 阅读(618) 评论(0) 推荐(0) 编辑
摘要:主窗口:package com.example.test;import android.app.Activity;import android.app.AlertDialog;import android.content.DialogInterface;import android.content.Intent;import android.os.Bundle;import android.view.KeyEvent;import android.view.View;import android.widget.EditText;public class MyActivity extends A 阅读全文
posted @ 2014-01-01 22:29 无忧之路 阅读(978) 评论(0) 推荐(0) 编辑
摘要:首先明确一点,用户的一直点击的返回键,之后就会退出到桌面。那么,如何提示呢?很简单,在用户一顿返回键回到程序入口处(即程序的第一个Activity)给用户一个提示,您再按可就退出程序啦?那么如何在程序入口处增加这个提示呢?明显,我们要侦听用户的点击返回键这一事件。怎样才能做到侦听这一事件呢?例如,在MainActivity中,覆盖这个方法: @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK && event.get... 阅读全文
posted @ 2014-01-01 22:18 无忧之路 阅读(247) 评论(0) 推荐(0) 编辑
摘要:在模拟器中使用Ctrl + F11 阅读全文
posted @ 2014-01-01 19:20 无忧之路 阅读(270) 评论(0) 推荐(0) 编辑
摘要:在安卓系统中,横竖屏切换会默认重新调用onCreate等生命周期方法,如果此时有一些临时数据没有保存下来,很有可能会导致该数据丢失。因此我们可以进行以下设置,来避免恒切换时重新调用onCreate方法: 阅读全文
posted @ 2014-01-01 19:18 无忧之路 阅读(1378) 评论(0) 推荐(0) 编辑
摘要:查看到底是哪个端口给占用了输入红色部分命令C:\Users\xxxxxx>netstat-ano|findstr"5037" TCP127.0.0.1:50370.0.0.0:0LISTENING4236 TCP127.0.0.1:5037127.0.0.1:49422ESTABLISHED4236 TCP127.0.0.1:49422127.0.0.1:5037ESTABLISHED3840发现确实有进程占用了5037端口只要想办法退出这些进程即可。酷狗2013最新版、豌豆荚、搜狗手机助手、金山手机助手都会占用这个端口,请查看。tastlist命令用于查看所有进程详 阅读全文
posted @ 2014-01-01 15:36 无忧之路 阅读(207) 评论(0) 推荐(0) 编辑

无忧之路
点击右上角即可分享
微信分享提示