我有一个对话框片段,当这个片段中的布局被夸大时:
当我更改此屏幕的方向时,对话框会变得紧凑,看起来好像它被迫适应横向模式并且不适合屏幕以适当的比例。我应该怎么做.....我尝试覆盖 onConfigurationChange() 方法并再次重新填充布局,但没有帮助我.....我需要知道如何增加方向更改对话框的区域?
这是我的布局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="4dip"
android:background="@drawable/techdeals_tip_screen" >
<Button
android:id="@+id/show"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_weight="0"
android:background="@android:color/transparent"
android:layout_gravity="right">
<requestFocus />
</Button>
这是我的对话片段:
public static class MyDialogFragment extends SherlockDialogFragment {
/**
* Create a new instance of MyDialogFragment.
*/
static MyDialogFragment newInstance() {
MyDialogFragment f = new MyDialogFragment();
return f;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Pick a style based on the num.
int style = DialogFragment.STYLE_NO_TITLE;
int theme = 0;
setStyle(style, theme);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.fragment_tips_dialog, container, false);
Button button = (Button)v.findViewById(R.id.show);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
dismiss();
}
});
return v;
}
@Override
public void onStop() {
super.onStop();
final Activity activity = getActivity();
launchNextScreen(getActivity());
activity.finish();
}
/** Method to launch home screen after tip screen. */
private void launchNextScreen(Activity activity) {
setViewedWelcomeScreen(activity);
activity.startActivity(new Intent(activity, HomeTabActivity.class));
}
}
任何帮助都将非常重要。