Я застрял, и я не понимаю, как это сделать. В моих приложениях есть окно AlertDialog Box со списком, содержащее изображение и текст, но текст становится белым по цвету и не отображается. Я хочу изменить цвет текста в ListView.Как изменить цвет текста контента в диалоговом окне «Предупреждение» android
Пожалуйста, помогите ...
отрывки являются следующие:
final String[] items = new String[]{"From Gallery", "From Camera"};
final Integer[] icons = new Integer[]{R.drawable.camera_picker, R.drawable.gallery_picker};
ListAdapter adapter = new CameraPickAdapter(StataComplaintActivity.this, items, icons);
final AlertDialog.Builder builder = new AlertDialog.Builder(this, AlertDialog.THEME_HOLO_LIGHT);
//AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.CustomAlertDialogTheme));
builder.setTitle("Select Image From")
.setAdapter(adapter, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int item) {
if (item == 0) {
loadImageFromGallery();
} else if (item == 1) {
takePictureIntent();
} else {
}
}
}).show();
CameraPickAdapter.java
public class CameraPickAdapter extends ArrayAdapter<String> {
private List<Integer> images;
public CameraPickAdapter(Context context, List<String> items, List<Integer> images) {
super(context, android.R.layout.select_dialog_item, items);
this.images = images;
}
public CameraPickAdapter(Context context, String[] items, Integer[] images) {
super(context, android.R.layout.select_dialog_item, items);
this.images = Arrays.asList(images);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
TextView textView = (TextView) view.findViewById(android.R.id.text1);
textView.setCompoundDrawablesWithIntrinsicBounds(images.get(position), 0, 0, 0);
textView.setCompoundDrawablePadding(
(int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, getContext().getResources().getDisplayMetrics()));
return view;
}
}
Диалог как:
вы можете поместить код CameraPickAdapter? –
@MoradiyaAkash Я добавил код для CameraPickAdapter – anand