关闭

菜单PopupMenu和对话框AlertDialog、进度条对话框PopupWindow用法相关例子和自己写的案例

400人阅读 评论(0) 收藏 举报
分类:

菜单

第一步:创建弹出菜单对象

PopupMenu popupMenu = new PopupMenu(Context context,   View anchor);

第一个参数view.cantext 始终可以得到一个cantext,第二个参数view弹出菜单的显示位置,显示在view的下面

第二步:载入菜单的布局文件

popupMenu.getMenuInflater().inflate(menuRes, menu)

第一个参数是布局文件的路劲(R.menu.item),第二个参数是popupMenu.getMenu()

只能载入文字的布局文件,不能带有图片(无法显示)

第三步:可设置监听器

OnMenuItemClickListener

package text.act;

import android.app.Activity;
import android.os.Bundle;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.PopupMenu;
import android.widget.TextView;

public class MainActivity extends Activity {
	private Button button;
	private TextView textView1;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.setContentView(R.layout.activity_main);
		this.button = (Button) findViewById(R.id.button);
		this.textView1 = (TextView) findViewById(R.id.textView1);
		this.button.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View view) {
				/**创建弹出菜单对象                   PopupMenu(Context context,   View anchor)
				 * 第2个参数view作用:弹出菜单显示在view的下面
				 */
				PopupMenu popupMenu = new PopupMenu(MainActivity.this, textView1);
				//为弹出菜单加载菜单项xml配置文件(res/menu/item.xml)
				
				popupMenu.getMenuInflater().inflate(R.menu.item,   popupMenu.getMenu()); 
				//为弹出菜单设置监听器(可选)
				popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
					@Override
					public boolean onMenuItemClick(MenuItem menuItem) {//menuItem菜单项对象
						int id = menuItem.getItemId();//得到被点击菜单项的id
						if(id == R.id.close) {
							MainActivity.this.textView1.setText("关闭");
						}else if(id == R.id.open) {
							textView1.setText("打开");
						}
						return false;
					}
				});
				//显示弹出菜单
				popupMenu.show();
			}
		});
	}
}
XML布局文件

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context="test.myapplication.MainActivity" >

    <Button
        android:id="@+id/button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="确定" />

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="出现PopuMenu" />

</LinearLayout>



普通对话框、列表对话框、单选对话框、复选对话框、进度条对话框、日期对话框、时间对话框

AlertDialog、PopupWindow、ProgressDialog、DataPickerDialog、TimePickeDialog

alertDialog.cancle  取消对话框

getProgress  读取当前进度

show()显示

cancle()取消

dismiss取消

setCancelable(false)禁止用户点击外围时取消显示

PopupWindow的特殊:取消对话框可以在子线程中执行(不增在子线程中操作页面);



Activity.java

package xena.act;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

/**
 * alertDialog.cancle();取消对话框
 */
public class MainActivity extends Activity implements android.view.View.OnClickListener {
	private Button btn_standardDialog, btn_MyDialog;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		this.btn_standardDialog = (Button) this
				.findViewById(R.id.btn_standardDialog);
		this.btn_MyDialog = (Button) this.findViewById(R.id.btn_MyDialog);
		this.btn_standardDialog.setOnClickListener(this);
		this.btn_MyDialog.setOnClickListener(this);
	}
	public View getView1() {
		TextView tv = new TextView(this);
		tv.setText("小明");
		tv.setTextSize(100);
		tv.setBackgroundColor(Color.WHITE);
		return tv;
	}
	
	public View getView2() {
		LayoutInflater layoutInflater = this.getLayoutInflater();
//		LayoutInflater layoutInflater = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View view = layoutInflater.inflate(R.layout.dialog, null);
		Button btn_sure = (Button) view.findViewById(R.id.btn_sure);
		final EditText editText = (EditText) view.findViewById(R.id.editText);
		btn_sure.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				String str = editText.getText().toString();
				Toast.makeText(v.getContext(), str, Toast.LENGTH_LONG).show();
				alertDialog.cancel();//取消对话框
			}
		});
		return view;
	}
	
	private AlertDialog alertDialog;
	@Override
	public void onClick(View v) {
		if (v.getId() == R.id.btn_MyDialog) {// 自定义对话框
			// 创建对话框的构造者对象 AlertDialog.Builder
			AlertDialog.Builder builder = new AlertDialog.Builder(this);
			builder.setView(this.getView2());//设置界面
//			builder.show();//创建AlertDialog并显示
			alertDialog = builder.create();//创建对话框
			alertDialog.show();//显示对话框
		} else if (v.getId() == R.id.btn_standardDialog) {// 标准对话框(普通对话框)
			// 创建标准对话框
			AlertDialog alertDialog = this.getAlertDialog4();
			// 显示标准对话框
			alertDialog.show();
		}
	}
	// 创建标准对话框
	public AlertDialog getAlertDialog1() {
		// 创建对话框的构造者对象 AlertDialog.Builder
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setTitle("天气");// 设置标题 可选
		builder.setMessage("晴转多云  40度");// 设置内容 可选
		builder.setIcon(R.drawable.ic_launcher);// 设置图片 可选

		// 创建对话框对象
		AlertDialog alertDialog = builder.create();
		return alertDialog;
	}
	// 创建标准对话框
	public AlertDialog getAlertDialog2() {
		// 创建对话框的构造者对象 AlertDialog.Builder
		return new AlertDialog.Builder(this).setTitle("天气")
				.setMessage("晴转多云  40度").setIcon(R.drawable.ic_launcher)
				.create();// 设置图片 可选
	}
	// 创建标准对话框,设置按钮,并设置监听器
	public AlertDialog getAlertDialog3() {
		// 创建对话框的构造者对象 AlertDialog.Builder
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setTitle("天气");// 设置标题 可选
		builder.setMessage("晴转多云  40度");// 设置内容 可选
		builder.setIcon(R.drawable.ic_launcher);// 设置图片 可选
		
		//设置铵钮和监听器 可选
		builder.setNegativeButton("确定右", new android.content.DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface arg0, int arg1) {
				 Toast.makeText(MainActivity.this, "确定右", Toast.LENGTH_LONG).show();
			}
		});
		//设置铵钮和监听器 可选
		builder.setNeutralButton("中取消", new android.content.DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface arg0, int arg1) {
				 Toast.makeText(MainActivity.this, "中取消", Toast.LENGTH_LONG).show();
			}
		});
		//设置铵钮和监听器 可选
		builder.setPositiveButton("左", new android.content.DialogInterface.OnClickListener() {
			@Override
			public void onClick(DialogInterface arg0, int arg1) {
				 Toast.makeText(MainActivity.this, "左", Toast.LENGTH_LONG).show();
			}
		});
		// 创建对话框对象
		AlertDialog alertDialog = builder.create();
		return alertDialog;
	}
	private android.content.DialogInterface.OnClickListener listener
		= new android.content.DialogInterface.OnClickListener() {
		@Override
		public void onClick(DialogInterface arg0, int arg1) {
			if(arg1 == DialogInterface.BUTTON_NEGATIVE) {
				 Toast.makeText(MainActivity.this, "确定右", Toast.LENGTH_LONG).show();
			}else if(arg1 == DialogInterface.BUTTON_NEUTRAL) {
				 Toast.makeText(MainActivity.this, "中取消", Toast.LENGTH_LONG).show();
			}else if(arg1 == DialogInterface.BUTTON_POSITIVE) {
				 Toast.makeText(MainActivity.this, "左", Toast.LENGTH_LONG).show();
			}
		}
	};
	public AlertDialog getAlertDialog4() {
		// 创建对话框的构造者对象 AlertDialog.Builder
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setTitle("天气");// 设置标题 可选
		builder.setMessage("晴转多云  40度");// 设置内容 可选
		builder.setIcon(R.drawable.ic_launcher);// 设置图片 可选
		//设置铵钮和监听器 可选
		builder.setNegativeButton("确定右", listener);
		//设置铵钮和监听器 可选
		builder.setNeutralButton("中取消", listener);
		//设置铵钮和监听器 可选
		builder.setPositiveButton("左", listener);
		// 创建对话框对象
		AlertDialog alertDialog = builder.create();
		return alertDialog;
	}
}
XML-----main_activity
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <Button
        android:id="@+id/btn_standardDialog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="标准对话框" />

    <Button
        android:id="@+id/btn_MyDialog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="自定义对话框" />

</LinearLayout>

XML----dialog
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="200dp"
    android:layout_height="150dp"
    android:orientation="vertical" >

    <Button
        android:id="@+id/btn_sure"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="确定" />

    <EditText
        android:id="@+id/editText"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:text=""
         />
</LinearLayout>

自己写的界面和对话框

package com.yt;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.PopupMenu;
import android.widget.PopupMenu.OnMenuItemClickListener;
import android.widget.TableLayout;
import android.widget.Toast;

@SuppressLint("NewApi")
public class MainActivity extends Activity {
	ImageView imager_jianpan, imgbnt_touxiang, imager_zidingyi,im_demo,im_erwei;
	Button bt_denglu;
	private AlertDialog builder;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_main);
		imager_jianpan = (ImageView) findViewById(R.id.imager_jianpan);
		imgbnt_touxiang = (ImageView) findViewById(R.id.imgbnt_touxiang);
		imager_zidingyi = (ImageView) findViewById(R.id.imager_zidingyi);
		bt_denglu = (Button) findViewById(R.id.bt_denglu);
		im_demo=(ImageView) findViewById(R.id.im_demo);
		/************************************* 菜单 **************************************************/
		imgbnt_touxiang.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				PopupMenu popupMenu = new PopupMenu(MainActivity.this,
						imgbnt_touxiang);
				popupMenu.getMenuInflater().inflate(R.menu.imager,
						popupMenu.getMenu());
				popupMenu
						.setOnMenuItemClickListener(new OnMenuItemClickListener() {

							@Override
							public boolean onMenuItemClick(MenuItem item) {

								return false;
							}
						});
				popupMenu.show();

			}
		});
		imager_jianpan.setOnClickListener(new OnClickListener() {
			@Override
			public void onClick(View v) {
				PopupMenu popupMenu = new PopupMenu(MainActivity.this,
						imager_jianpan);
				popupMenu.getMenuInflater().inflate(R.menu.main,
						popupMenu.getMenu());
				popupMenu
						.setOnMenuItemClickListener(new OnMenuItemClickListener() {

							@Override
							public boolean onMenuItemClick(MenuItem item) {

								return false;
							}
						});
				popupMenu.show();
			}
		});
		/*************************** 菜单 *********************************************/
		/********************************** 标准对话框 ***********************************************/
		bt_denglu.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				AlertDialog alertDialog = this.getAlertDialog();
				alertDialog.setCancelable(true);
				alertDialog.show();

			}

			private android.content.DialogInterface.OnClickListener listener = new android.content.DialogInterface.OnClickListener() {

				@Override
				public void onClick(DialogInterface dialog, int which) {
					if (which == DialogInterface.BUTTON_NEGATIVE) {
						Toast.makeText(MainActivity.this, "正在更新",
								Toast.LENGTH_LONG).show();
					} else if (which == DialogInterface.BUTTON_NEUTRAL) {
						Toast.makeText(MainActivity.this, "取消",
								Toast.LENGTH_LONG).show();
					} else if (which == DialogInterface.BUTTON_POSITIVE) {
						Toast.makeText(MainActivity.this, "确定",
								Toast.LENGTH_LONG).show();
					}
				}
			};

			public AlertDialog getAlertDialog() {
				AlertDialog.Builder builder = new AlertDialog.Builder(
						MainActivity.this);
				builder.setTitle("心情");
				builder.setMessage("正在更新心情······");
				builder.setIcon(R.drawable.xiao);
				builder.setNegativeButton("更新", listener);
				builder.setNeutralButton("取消", listener);
				builder.setPositiveButton("确定", listener);
				AlertDialog aDialog = builder.create();
				return aDialog;
			}

		});
		/****************************** 标准对话框 *****************************************/
/*********************************自定义对话框******************************************************/		
		imager_zidingyi.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
				builder.setView(MainActivity.this.getView());
				builder.create();
				builder.show();
				
			}
		});
	}

	
	public final View getView() {
		LayoutInflater layoutInflater = this.getLayoutInflater();
		View view = layoutInflater.inflate(R.layout.activity_view, null);
		TableLayout id = (TableLayout) view.findViewById(R.id.id);
		Button bt_denglu = (Button) view.findViewById(R.id.bt_denglu);
		final EditText ed_name = (EditText) view.findViewById(R.id.ed_name);
		final EditText ed_pass = (EditText) view.findViewById(R.id.ed_pass);
		bt_denglu.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				String str = ed_name.getText().toString();
				String str1 = ed_pass.getText().toString();
				Toast.makeText(MainActivity.this,str+str1, Toast.LENGTH_LONG).show();
				//builder.cancel();
			}
		});
		return view;
	}
	/***************************自定义对话框**************************************************************/
}

XML---main_activity

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TableLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="20dp" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="200dp"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="50dp"
            android:background="#00aee8"
            android:gravity="center" >

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#00aee8"
                android:gravity="center" >

                <ImageView
                    android:id="@+id/imager_zidingyi"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:src="@drawable/qq" />

                <FrameLayout
                    android:id="@+id/FrameLayout1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:background="#00aee8"
                    android:gravity="center" >

                    <ImageView
                        android:id="@+id/imageView2"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_gravity="bottom"
                        android:src="@drawable/q" />

                    <ImageView
                        android:id="@+id/imageView3"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_gravity="bottom"
                        android:layout_marginLeft="20dp"
                        android:src="@drawable/q" />
                </FrameLayout>
            </TableRow>
        </LinearLayout>

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="horizontal" >

            <FrameLayout
                android:id="@+id/frameLayout2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <ImageView
                    android:id="@+id/imgbnt_touxiang"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_marginTop="2dp"
                    android:scaleType="centerCrop"
                    android:src="@drawable/xiao" />

                <ImageView
                    android:id="@+id/imageView5"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_gravity="bottom"
                    android:layout_marginLeft="86dp"
                    android:src="@drawable/zai" />
            </FrameLayout>

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/frameLayout2"
                android:orientation="vertical" >

                <EditText
                    android:id="@+id/ed_name"
                    android:layout_width="180dp"
                    android:layout_height="30dp"
                    android:layout_marginTop="20dp"
                    android:inputType="number"
                    android:background="@drawable/edit_bg"
                    android:ems="10"
                    android:hint="@string/zhanghao" />

                <FrameLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <EditText
                        android:id="@+id/ed_pass"
                        android:layout_width="180dp"
                        android:layout_height="30dp"
                        android:layout_marginTop="10dp"
                        android:background="@drawable/edit_bg"
                        android:inputType=""
                        android:ems="10"
                        android:password="true"
                        android:digits="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@:/*-+=`#*"
                        android:hint="@string/mima" />

                    <ImageView
                        android:id="@+id/imager_jianpan"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="bottom"
                        android:layout_marginLeft="155dp"
                        android:src="@drawable/jianpan" />
                </FrameLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <CheckBox
                        android:id="@+id/checkBox1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/jizhu"
                        android:textSize="10sp"
                        android:textColor="#919496" />

                    <CheckBox
                        android:id="@+id/checkBox2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/wangji"
                        android:textSize="10sp"
                        android:textColor="#919496" />
                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/linearLayout1"
                android:orientation="vertical" >

                <TextView
                    android:id="@+id/t_zhucezhanghao"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="5dp"
                    android:text="@string/zhuce"
                    android:textColor="#009dd8" />

                <TextView
                    android:id="@+id/textView2"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="15dp"
                    android:text="@string/zhaohui"
                    android:textColor="#009dd8" />
            </LinearLayout>
        </RelativeLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:gravity="center"
            android:orientation="vertical" >

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <Button
                    android:id="@+id/bt_denglu"
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="90dp"
                    android:background="@drawable/jun"
                    android:text="@string/denglu"
                    android:textColor="#ffffff" />

                <ImageView
                    android:id="@+id/imageView4"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="130dp"
                    android:src="@drawable/anquan" />

                <ImageView
                    android:id="@+id/im_demo"
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_gravity="bottom"
                    android:src="@drawable/tianjia" />

                <ImageView
                    android:id="@+id/im_erwei"
                    android:layout_width="25dp"
                    android:layout_height="25dp"
                    android:layout_gravity="bottom"
                    android:layout_marginLeft="310dp"
                    android:src="@drawable/erwei" />
            </FrameLayout>
        </LinearLayout>
    </TableLayout>

</TableLayout>

XML----activity_view

<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/TableLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity" >

    <TableLayout
        android:id="@+id/id"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
       >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="200dp"
            android:layout_gravity="center"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:layout_marginTop="10dp"
            android:background="#00aee8"
            android:gravity="center" >

            <TableRow
                android:id="@+id/tableRow1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="#00aee8"
                android:gravity="center" >

                <ImageView
                    android:id="@+id/imager_zidingyi"
                    android:layout_width="50dp"
                    android:layout_height="50dp"
                    android:src="@drawable/qq" />

                <FrameLayout
                    android:id="@+id/FrameLayout1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="bottom"
                    android:background="#00aee8"
                    android:gravity="center" >

                    <ImageView
                        android:id="@+id/imageView2"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_gravity="bottom"
                        android:src="@drawable/q" />

                    <ImageView
                        android:id="@+id/imageView3"
                        android:layout_width="30dp"
                        android:layout_height="30dp"
                        android:layout_gravity="bottom"
                        android:layout_marginLeft="20dp"
                        android:src="@drawable/q" />
                </FrameLayout>
            </TableRow>
        </LinearLayout>

        <RelativeLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:orientation="horizontal" >

            <FrameLayout
                android:id="@+id/frameLayout2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" >

                <ImageView
                    android:id="@+id/imgbnt_touxiang"
                    android:layout_width="100dp"
                    android:layout_height="100dp"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_marginTop="2dp"
                    android:scaleType="centerCrop"
                    android:src="@drawable/xiao" />

                <ImageView
                    android:id="@+id/imageView5"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_gravity="bottom"
                    android:layout_marginLeft="86dp"
                    android:src="@drawable/zai" />
            </FrameLayout>

            <LinearLayout
                android:id="@+id/linearLayout1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_toRightOf="@+id/frameLayout2"
                android:orientation="vertical" >

                <EditText
                    android:id="@+id/ed_name"
                    android:layout_width="180dp"
                    android:layout_height="30dp"
                    android:layout_marginTop="20dp"
                    android:inputType="number"
                    android:background="@drawable/edit_bg"
                    android:ems="10"
                    android:hint="@string/zhanghao" />

                <FrameLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" >

                    <EditText
                        android:id="@+id/ed_pass"
                        android:layout_width="180dp"
                        android:layout_height="30dp"
                        android:layout_marginTop="10dp"
                        android:background="@drawable/edit_bg"
                        android:inputType=""
                        android:ems="10"
                        android:password="true"
                        android:digits="0123456789abcdefghigklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@:/*-+=`#*"
                        android:hint="@string/mima" />

                    <ImageView
                        android:id="@+id/imager_jianpan"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_gravity="bottom"
                        android:layout_marginLeft="155dp"
                        android:src="@drawable/jianpan" />
                </FrameLayout>

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:orientation="horizontal" >

                    <CheckBox
                        android:id="@+id/checkBox1"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/jizhu"
                        android:textSize="10sp"
                        android:textColor="#919496" />

                    <CheckBox
                        android:id="@+id/checkBox2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:text="@string/wangji"
                        android:textSize="10sp"
                        android:textColor="#919496" />
                </LinearLayout>
            </LinearLayout>

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerVertical="true"
                android:layout_toRightOf="@+id/linearLayout1"
                android:orientation="vertical" >
            </LinearLayout>
        </RelativeLayout>

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="10dp"
            android:layout_marginRight="10dp"
            android:gravity="center"
            android:orientation="vertical" >

            <FrameLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" 
                android:layout_marginBottom="10dp">

                <Button
                    android:id="@+id/bt_denglu"
                    android:layout_width="200dp"
                    android:layout_height="wrap_content"
                    android:layout_marginLeft="90dp"
                    android:background="@drawable/jun"
                    android:text="@string/denglu"
                    android:textColor="#ffffff" />

                <ImageView
                    android:id="@+id/imageView4"
                    android:layout_width="20dp"
                    android:layout_height="20dp"
                    android:layout_gravity="center_vertical"
                    android:layout_marginLeft="130dp"
                    android:src="@drawable/anquan" />
            </FrameLayout>
        </LinearLayout>
    </TableLayout>

</TableLayout>



0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:2539次
    • 积分:152
    • 等级:
    • 排名:千里之外
    • 原创:13篇
    • 转载:2篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档