- 浏览: 20613 次
最新评论
文章列表
Bashboard.java
Intent i = new Intent(this, NewAccount.class);
startActivityForResult(i, 0);
onActivityResult(......){
if(data!=null){
Bundle bundle=data.getExtras();
.........
}
}
NewAccount.java
Bundle bundle = new Bundle();
bundle.putString("returnStatus", action);
Intent mInt ...
见附件源码.
看一遍就懂了,很简单的例子.
android listview 上拉刷新
- 博客分类:
- android
具体源码见,附件下载。
这里列出关键性思路:
1.先定义一个布局文件,里面放个ListView,配置宽,高。
2.再定义一个布局文件(此定义的是listview里行的布局文件),例子里面只有一个textview
3.再定义一个布局文件(此定义的是listview,addFooterView(View view)里面的view的布局),例子里面是一个ProgressBar和一个textview.很明显这个就是那个转的和提示文字。
4.开始写主Activity的代码
(1)实例化这个listview,然后创建一个adapter,这个adapter里面用的布局就是2的布局,但要注意,在setAdap ...
android post get
- 博客分类:
- android
//post
HttpClient client=new DefaultHttpClient();
HttpPost post=new HttpPost("路径");
post.setHeader("Content-Type","application/x-www-form-urlencoded");
List<NameValuePair> pairs=new ArrayList<NameValuePair>();
pairs.add(new BasicNameValuePair("device_uui ...
表单 enctype
- 博客分类:
- web
<form>表单中的enctype
不写,默认的enctype是application/x-www-form-urlencoded
这个属性管理的是表单的MIME(Multipurpose Internet Mail Extensions),大白话就是告诉服务器,传给它的是什么数据。
有三个值可选:
1.application/x-www-form-urlencoded(默认传输编码类型)
2.multipart/form-data
是用来指定传输数据的特殊类型的,主要就是我们上传的非文本的内容,比如图片,文件或者mp3等等.
3.text/plain
是纯文本传输的意思,在发送邮件 ...
android 分隔线
- 博客分类:
- android
android 分隔线
1.用View 配置文件
<View
android:layout_width="match_parent"
android:layout_height="1dip"
android:background="@android:color/darker_gray"
android:layout_marginTop="6dip"/>
2.用ImageView 代码
ListView listView=(ListView)findV ...
android textview
- 博客分类:
- android
textview 标题style设置.
<style name="WordPressSectionHeader"
parent="@android:style/Widget.TextView">
<item name="android:textSize">16dp</item>
<item name="android:textStyle">bold</item>
<item name="and ...
android经典edittext选中样式是,黄色,不选中是灰色。下面附上android经典实现的配置,以便于用户根据自己的需要进行修改.
//文件位置位于,android-sdk/platforms/android-13/data/res/drawable/editbox_background.xml
editbox_background.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused=& ...
android 布局边框
- 博客分类:
- android
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/content_bg"
android:paddingBottom="10dp">
</RelativeLayout>
drawable/content_bg.xml
<?xml version=" ...
//startActivityForResult()情况的Intent
@Override
public boolean onKeyDown(int i, KeyEvent event) {
// only intercept back button press
if (i == KeyEvent.KEYCODE_BACK) {
Bundle bundle = new Bundle();
bundle.putString("returnStatus", "CANCEL");
Intent mIntent = new Inte ...
android 文字描边
- 博客分类:
- android
文字描边
android:shadowColor="#FFFFFFFF"
android:shadowDx="0"
android:shadowDy="1"
android:shadowRadius="1"
例子
<TextView
android:id="@+id/welcome"
android:layout_width="wrap_content"
android:layout_height="wrap_content ...
android 渐变背景
- 博客分类:
- android
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<gradient
android:startColor="#ffa6a6a6"
android:centerColor="#ffdbdbdb&q ...
android button 自定义
- 博客分类:
- android
wp_button.xml(\drawable目录下建个)
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
andorid:state_window_focused="false"
android:state_enabled="true"
android:drawable= ...
android application
- 博客分类:
- android
android 开发中共享全局数据
我们在平时的开发中,有时候可能会需要一些全局数据,来让应用中的所以Activity和View都能访问到,大家在遇到这种情况时,可能首先会想到自己定义一个类,然后创建很多静态成员,不过android已经为 ...