<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="#000000">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="120dp"
android:orientation="vertical"
android:layout_weight="1"
android:background="@drawable/bc"
>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_weight="1"
android:background="#eee685"
android:orientation="vertical" >
<EditText
android:id="@+id/EditText01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp"
android:background="#ffffff"
android:drawableLeft="@drawable/user"
android:layout_weight="1"
android:ems="10"
android:hint="请输入用户名"
android:textSize="15dp" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:drawableLeft="@drawable/pwd_lock"
android:background="#ffffff"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginTop="15dp"
android:layout_weight="1"
android:hint="请输入密码"
android:textSize="15dp"
>
<requestFocus />
</EditText>
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=" 记住密码"
android:layout_marginLeft="15dp"
android:layout_marginTop="15dp"
android:layout_weight="3"
android:button="@drawable/drawanle"
/>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/btn_login_normal"
android:layout_gravity="top|center"
android:layout_weight="3"
android:layout_marginTop="25dp"/>
</LinearLayout>
</LinearLayout>
package com.example.ddddwa;
import java.util.ArrayList;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;
public class DwadMainActivity extends Activity implements OnItemLongClickListener {
ListView ls;
ArrayList<Sudent> date = new ArrayList<Sudent>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_dwad_main);
ls=(ListView) findViewById(R.id.listView1);
ls.setAdapter( new MyAdapter());
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
date.add(new Sudent("张三","身高:188cm","体重:200kg"));
ls.setOnItemLongClickListener(this);
}
class MyAdapter extends BaseAdapter{
@Override
public int getCount() {
// TODO Auto-generated method stub
return date.size();
}
@Override
public Object getItem(int position) {
// TODO Auto-generated method stub
return date.get(position);
}
@Override
public long getItemId(int position) {
// TODO Auto-generated method stub
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
if (convertView==null) {
convertView=View.inflate(getApplicationContext(), R.layout.nvgh, null);
}
Sudent sudent = date.get(position);
TextView t1=(TextView) convertView.findViewById(R.id.textView1);
TextView t2=(TextView) convertView.findViewById(R.id.textView2);
TextView t3=(TextView) convertView.findViewById(R.id.textView3);
t1.setText(sudent.getName());
t2.setText(sudent.getSg());
t3.setText(sudent.getTz());
return convertView;
}
}
AlertDialog create ;
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view,
int position, long id) {
final AlertDialog.Builder ad=new AlertDialog.Builder(this);
View inflate = View.inflate(getApplicationContext(), R.layout.tex, null);
LinearLayout qx = (LinearLayout) inflate.findViewById(R.id.qx);
qx.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
create.cancel();
}
});
ad.setView(inflate);
ad.setCancelable(false);
create = ad.create();
create.show();
return false;
}
}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/user"
android:layout_weight="1"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:layout_weight="1" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="张三"
android:gravity="center_vertical"
android:textSize="20dp"
android:textColor="#000000"/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="身高 123"
android:textColor="#3000ff"
android:gravity="center_vertical"/>
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textColor="#3000ff"
android:text="体重 321"
android:gravity="center_vertical"/>
</LinearLayout>
<ImageView
android:id="@+id/imageView2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/arrows"
android:layout_weight="1"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:layout_gravity="center_vertical"
android:text="警告"
android:textSize="20dp"
android:layout_weight="1"
android:drawableLeft="@drawable/user"
android:textColor="#0090ff"/>
</LinearLayout>
<TextView
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="#0090ff" />
<TextView
android:id="@+id/textView3"
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_weight="1.00"
android:text="你没有权限删除!"
android:gravity="center"
android:textColor="#000000"
android:textSize="17dp" />
<TextView
android:id="@+id/textView4"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#999999"/>
<LinearLayout
android:id="@+id/qx"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical" >
<TextView
android:layout_width="match_parent"
android:layout_height="60dp"
android:layout_weight="0.23"
android:gravity="center"
android:text="取消"
android:textColor="#000000"
android:textSize="13dp" />
</LinearLayout>
</LinearLayout>
package com.example.ddddwa;
public class Sudent {
String name;
String sg;
String tz;
public Sudent(){
}
public Sudent(String name, String sg, String tz) {
super();
this.name = name;
this.sg = sg;
this.tz = tz;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSg() {
return sg;
}
public void setSg(String sg) {
this.sg = sg;
}
public String getTz() {
return tz;
}
public void setTz(String tz) {
this.tz = tz;
}
}