Отображается диалоговое окно с предупреждением при нажатии одного из элементов в списке.Все хорошо, за исключением того, что расположение заголовка для диалога неверно, как показано на рисунке ниже.Почему заголовок расположен под строкой, а не над строкой?
Код диалогового окна предупреждения
ListView listView = (ListView)findViewById(R.id.listView);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
final AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this,
android.R.style.Theme_Holo_Light_Dialog);
View view2 = getLayoutInflater().inflate(R.layout.dialog,null);
builder.setView(view2);
builder.setTitle("Edit")
.setCancelable(false)
// Add action buttons
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
//
refreshData();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
})
.setIcon(android.R.drawable.ic_menu_edit)
.show();
}
});
Расположениедиалоговое окно оповещения
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/dialog_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<EditText
android:id="@+id/edittext_date"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Date"
android:inputType="text" />
<EditText
android:id="@+id/edittext_point"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Point"
android:inputType="numberSigned" />
<EditText
android:id="@+id/edittext_description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ems="10"
android:hint="Description"
android:inputType="text" />
</LinearLayout>