21. android dialog——自定义对话框之二
2011-04-27 23:06
453 查看
先建立一个layout,命名为customer_dialog.xml
然后在昨天的android dialog——自定义对话框之一 的修改onCreate方法,修改如下:
关于LayoutInflate详解, 请参照 android Tab 选项卡控件 里的注释
以上就是在昨天的基础之上增加的自定义xml,其他任何代码都不用动了,很简单,接下来将继续添加事件监听
还是来个效果图吧,貌似比昨天的漂亮一点:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingRight="10dip" android:paddingLeft="10dip"> <TextView android:id="@+id/userNameText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18dip" android:text="用户名:" android:paddingRight="10dip" /> <EditText android:id="@+id/userNameEditText" android:text="输入用户名" android:layout_width="fill_parent" android:layout_height="wrap_content" android:lines="1" /> </LinearLayout>
然后在昨天的android dialog——自定义对话框之一 的修改onCreate方法,修改如下:
@Override protected void onCreate(Bundle savedInstanceState) { //关于LayoutInflate详解 //http://blog.csdn.net/jamesliulyc/archive/2011/04/14/6324432.aspx LayoutInflater inflater = LayoutInflater.from(context); View customerLayout = inflater.inflate(R.layout.customer_dialog, null); setView(customerLayout); super.onCreate(savedInstanceState); }
关于LayoutInflate详解, 请参照 android Tab 选项卡控件 里的注释
以上就是在昨天的基础之上增加的自定义xml,其他任何代码都不用动了,很简单,接下来将继续添加事件监听
还是来个效果图吧,貌似比昨天的漂亮一点:
相关文章推荐
- Android 对话框(Dialog) 及 自定义Dialog
- Android-Dialog对话框 全解(普通对话框,单选对话框,多选对话框,列表对话框,自定义对话框,Activity对话框)
- 【android】自定义dialog对话框
- Android 自定义对话框dialog
- Android 日常封装之暴力CustomViewDialog自定义对话框
- Android 自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android中自定义对话框(Dialog)的实例代码
- Android AlertDialog 方法setView(view,0,0,0,0)开发自定义对话框
- Android多种方式实现自定义Dialog对话框
- Android之Dialog自定义对话框
- Android之自定义对话框AlertDialog.Builder+getLayoutInflater().inflate
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- Android自定义对话框(Dialog)位置,大小
- android的自定义dialog对话框实现
- Android自定义对话框(Dialog)位置,大小
- Android UI设计系列之自定义Dialog实现各种风格的对话框效果(7)
- Android中自定义对话框(Dialog) (转)
- Android之自定义dialog对话框