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

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

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>

 

posted @ 2016-05-16 21:05  zyy明天你好  阅读(7750)  评论(0编辑  收藏  举报