Dialog里面显示小框架

项目中少不了的小框架图

目前创新互联建站已为上千的企业提供了网站建设、域名、网站空间成都网站托管、企业网站设计、长泰网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

public void showLayout(){

AlertDialog.Builder dialog = new AlertDialog.Builder(SmallMainActivity.this);//当前的Context

AlertDialog alert = dialog.create();

LayoutInflater inflater = alert.getLayoutInflater();

View view = inflater.inflate(R.layout.test_layout, null);//

alert.setView(view);

final Button btn = (Button) view.findViewById(R.id.button1_test);

final TextView text = (TextView) view.findViewById(R.id.textView1);

final SeekBar seekbar = (SeekBar) view.findViewById(R.id.seekBar1);

btn.setOnClickListener(new OnClickListener() {

@Override

public void onClick(View arg0) {

// TODO Auto-generated method stub

Toast.makeText(SmallMainActivity.this, "click", Toast.LENGTH_LONG).show();

}

});

seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {

@Override

public void onStopTrackingTouch(SeekBar seekBar) {

// TODO Auto-generated method stub

}

@Override

public void onStartTrackingTouch(SeekBar seekBar) {

// TODO Auto-generated method stub

}

@Override

public void onProgressChanged(SeekBar seekBar, int progress,

boolean fromUser) {

// TODO Auto-generated method stub

text.setText(progress + "");

}

});

alert.show();//这一句是用来显示的,不能少

}

// res/layout 下的 test_layout.xml布局

    android:layout_width="match_parent"

    android:layout_height="match_parent"

    android:orientation="vertical" >

   

        android:id="@+id/textView1"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:text="0" />

   

        android:id="@+id/seekBar1"

        android:layout_width="match_parent"

        android:layout_height="wrap_content" />

   

        android:id="@+id/button1_test"

        android:layout_width="match_parent"

        android:layout_height="wrap_content"

        android:text="Button" />

   

        android:id="@+id/ratingBar1"

        android:layout_width="wrap_content"

        android:layout_height="wrap_content" />


网站名称:Dialog里面显示小框架
链接分享:http://myzitong.com/article/jscjgs.html