`
文章列表

ProgressDialog

protected void onCreate(Bundle savedInstanceState) { button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { openProcessDialog(true); Intent i = new Intent(); i.setClass(Mai ...

first time tips

private boolean isFirstClick(){ SharedPreferences sp = getSharedPreferences(Constants.GET_EFAX_KEY, Context.MODE_PRIVATE); //在Constants类中设定一final value,存储,以便一次点击事件后不再显示 boolean firstclick = sp.getBoolean(Constants.GET_SHAREDPREF_EFAX_KEY, true); return firstclick; } private void se ...
1.JNI文件夹会导致IDE崩溃,先取出等工程导入后再复制进工程 2.导libs 3.通过project的properties重新选择路径 4.build ndk 5.change project jni android.mk opencv path    SVN: 1.使用export获取服务器上代码 2.checkout自己的路径 3.若要删除SVN路径,可以下载脚本

PopupWindow简要

 
 1.在layout里新建一popwindow.xml   2.在Activity里 //popwindow part    private ImageButton popButton;    private boolean click = true;    private PopupWindow popUp;    private View layout;   final View poplayout = this.getLayoutInflater().inflate(R.layout.popwindow, null); popUp = new PopupWindow(po ...
一.怎么进行缩放填充图像到ImageButtonandroid:scaleType="fitXY“android:scaleType  设置图像的填充方式 fitXY             把图片不按比例扩大/缩小到View的大小显示 说一下要注意的: 这么做的话,如果控件的长宽比和图像的长宽比不同的话就与比较严重的失真。所以要多注意一下.尤其是多分辨率适配的时候。多做真机调试 使用这个方法填充的时候是必须配合android:src来使用的。对于android:background是无效的. android:src="@drawable/miss"  ...
  listview加载adapter过程是这样的.1 先判断adapter 有多少数据项,根据这个数据确定有多少item. 2 确定每个item里加载哪个View. 3 把View里加载要显示的数据.问提一个一个来解决. 第一个问题: 因为
创建ArrayAdapter时候必须指定一个resource,该参数决定每个列表项的外观样式  simple_list_item_1: 每个列表项都是一个普通的TextView  simple_list_item_2: 有两个TextView,一个单独在一行,就是分两行显示  simple_list_item_checked: 每个列表项都是一个已勾选的列表项  simple_list_item_multiple_choice: 每个列表项都是带多选框的文本
其实,说白了,学过JavaWeb的应该知道域,我感觉这个Context就跟域相似,存在于整个应用中     Context字面意思上下文,位于framework package的android.content.Context中,其实该类为LONG型,类似Win32中的Handle句柄,很多方法需要通过Con ...
1.登陆http://msysgit.github.io/下载Windows下的Git   2.创建代码仓库: git config --global user.name "XXX" git config --global user.email XXX@XXX.com   3.进入到项目目录下 cd ..\path\..   4.git init 创建代码仓库   5.ls -al查看所有命令   6.添加文件 git add . 并用 git commit -m "XXX"  提交   7.登陆https://github ...
 1.ListView简单用法 第一步: 在activity_main.xml中增加: <ListView        android:id="@+id/list_view"        android:layout_width="match_parent"        android:layout_height="wrap_content"  />   第二步: ArrayAdapter<String> adapter = new ArrayAdapter<String>(Ma ...

LayoutInflater用法

在实际开发中LayoutInflater这个类还是非常有用的,它的作用类似于findViewById()。不同点是LayoutInflater是用来找res/layout/下的xml布局文件,并且实例化;而findViewById()是找xml布局文件下的具体widget控件(如Button、TextView等)。 具体作用: 1、对于一个没有被载入或者想要动态载入的界面,都需要使用LayoutInflater.inflate()来载入; 2、对于一个已经载入的界面,就可以使用Activiyt.findViewById()方法来获得其中的界面元素。 LayoutInflater 是一个抽象 ...
Android开发去除标题栏title其实非常简单,有两种方法,一种是在代码中添加,另一种是在AndroidManifest.xml中添加: 1、在代码中实现: 在此方法setContentView(R.layout.main)之前加入: requestWindowFeature(Window.FEATURE_NO_TITLE);标题栏就没有了。 2、在AndroidManifest.xml中实现: 注册Activity时加上如下的一句配置就可以实现。 <activity android:name=".Activity" android:theme=" ...

自定义控件

1.自定义布局 新建一个title.xml的Layout<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="wrap_content"    android:weightSum="1">       <Button        android:id="@+i ...
1.LinearLayout //线性布局 android:orientation=""  //设置控件的排列方式 horizontal 垂直  vertical 水平   <EditText        android:id="@+id/edit_text"        android:layout_width="0dp"        android:layout_height="wrap_content"        android:layout_weight="1&qu ...
1.TextView: match_parent:当前控件大小和父布局一样 wrap_parent:控件大小刚好包住内容 anroid:gravity="center" :居中   2.EditText: anroid:hint="Type something here" //提示性文本 anroid:maxLines="2" //最大行数,文本向上滚动 ...
Global site tag (gtag.js) - Google Analytics