您好,登录后才能下订单哦!
项目中少不了的小框架图
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" />
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。