Dialog的Activitty
public class CarFaBu extends Activity implements View.OnClickListener {
private TextView fabuxinxi;
private TextView history;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.car_fabu);
initView();
}
private void initView(){
fabuxinxi = (TextView)findViewById(R.id.car_fabu);
history = (TextView)findViewById(R.id.car_fabu_history);
fabuxinxi.setOnClickListener(this);
history.setOnClickListener(this);
}
@Override
public void onClick(View v) {
Intent intent;
switch (v.getId()){
case R.id.car_fabu:
intent = new Intent();
intent.setClass(CarFaBu.this,CarInShowformationActivity.class);
startActivity(intent);
finish();
break;
case R.id.car_fabu_history:
intent = new Intent();
intent.setClass(CarFaBu.this,CarHistory.class);
startActivity(intent);
finish();
break;
}
}
@Override
public boolean onTouchEvent(MotionEvent event)
{
finish();
return true;
}
在配置文件中配置
<activity android:name=".dialog.OrderOk"
android:theme="@style/Dialog"></activity>
Dialog的Style风格
<style name="Dialog" parent="@android:style/Theme.Dialog" >
<item name="android:windowNoTitle">true</item>
</style>
热门评论
真机运行的时候,布局设置的全部宽度无效,会有一定的边距,只要是dialog相关都会这样
用fragmentdialog不好么?
楼主用的方法是将activity的样式设置为dialog。安卓中,activity使用此样式会使activity的宽度变为dialog一样的宽度。