码迷,mamicode.com
首页 > 其他好文 > 详细

dialog弹出框,自定义里面的布局;

时间:2016-05-16 21:53:16      阅读:273      评论:0      收藏:0      [点我收藏+]

标签:

//代码里面的设置,点击触发弹出对话框;

case R.id.re_ps:
// 配送费
final Dialog dialog1 = new Dialog(this);

View contentView1 = LayoutInflater.from(this).inflate(
R.layout.activity_send_peisong, null);
dialog1.setContentView(contentView1);
dialog1.setTitle("配送费用");
dialog1.setCanceledOnTouchOutside(true);
seekBar = (SeekBar) contentView1.findViewById(R.id.seekBar11);
num_tv = (TextView) contentView1.findViewById(R.id.num_tv);
Button price_cancle = (Button) contentView1
.findViewById(R.id.s_cancel);
Button price_true = (Button) contentView1.findViewById(R.id.s_ok);
price_true.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
textView_fy.setText(numbers + "");
dialog1.dismiss();
}
});
price_cancle.setOnClickListener(new OnClickListener() {

public void onClick(View v) {
// TODO Auto-generated method stub
dialog1.dismiss();
}
});
dialog1.show();
initSeekBarProgress();
break;

 

xml布局;

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ps"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="#ffffff"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_marginTop="20px"
        android:id="@+id/linearLayout1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:orientation="vertical" >

        <TextView
            android:id="@+id/num_tv"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/publish_seekbar_dialog"
            android:gravity="center_horizontal"
            android:paddingTop="1dp"
            android:text="0"
            android:textColor="#ffffff" />

        <SeekBar
            android:id="@+id/seekBar11"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="50px"
            android:max="100"
            android:progress="0"
            android:progressDrawable="@drawable/seekbar_img"
            android:thumb="@drawable/thumb" />
    </LinearLayout>

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginTop="50px"
    android:layout_marginBottom="50px"
    android:layout_alignParentLeft="true"
    android:layout_below="@+id/linearLayout1" >

    
    <Button
        android:id="@+id/s_cancel"
        android:layout_width="100px"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_marginRight="55dp"
        android:layout_toLeftOf="@+id/s_ok"
        android:background="@drawable/dialog_btn_right_checked"
        android:text="取消" />
    <Button
        android:id="@+id/s_ok"
        android:layout_width="100px"
        android:layout_height="wrap_content"
        android:layout_alignBaseline="@+id/s_cancel"
        android:layout_alignBottom="@+id/s_cancel"
        android:layout_alignParentRight="true"
        android:layout_marginRight="80dp"
        android:background="@drawable/dialog_btn_right_checked"
        android:text="确认" />

    
</RelativeLayout>

</RelativeLayout>

 

dialog弹出框,自定义里面的布局;

标签:

原文地址:http://www.cnblogs.com/zhengyanyan/p/5499484.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!