zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    WebSocket使用及优化(心跳机制与断线重连)
    JS案例:触底懒加载
    你知道近来年大火的DDD是如何兴起的吗?以及与微服务的关系
    Sql Server的Cross Apply用法
    跨域信息传递解决方案
    【转】理解字节序
    NATAPP优惠码
    <学习笔记>筛法
    <学习笔记>线性基
    【react + BizCharts】
  • 原文地址:https://www.cnblogs.com/zhengyanyan/p/5499484.html
Copyright © 2011-2022 走看看