我尝试创建一个带有重力端的片段以将其与NavigationMenu一起使用,但我的问题是找不到match_parent,因为片段不是全屏宽度。
这是我的xml:
/**
* Creates a dialog and shows it
*
* @param exception
* The exception to show in the dialog
* @param title
* The dialog title
*/
private void createAndShowDialogFromTask(final Exception exception, String title) {
runOnUiThread(new Runnable() {
@Override
public void run() {
createAndShowDialog(exception, "Error");
}
});
}
/**
* Creates a dialog and shows it
*
* @param exception
* The exception to show in the dialog
* @param title
* The dialog title
*/
private void createAndShowDialog(Exception exception, String title) {
Throwable ex = exception;
if (exception.getCause() != null) {
ex = exception.getCause();
}
createAndShowDialog(ex.getMessage(), title);
}
/**
* Creates a dialog and shows it
*
* @param message
* The dialog message
* @param title
* The dialog title
*/
private void createAndShowDialog(final String message, final String title) {
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(message);
builder.setTitle(title);
builder.create().show();
}
但宽度与父母不匹配:
如果有任何想法,请帮助我,提前致谢。