15
Come posso ottenere colore di sfondo e colore del testo (predefinito per le viste secondarie) di un'attività in Java?Android: come ottenere il colore di sfondo dell'attività in Java?
Come posso ottenere colore di sfondo e colore del testo (predefinito per le viste secondarie) di un'attività in Java?Android: come ottenere il colore di sfondo dell'attività in Java?
TypedArray array = getTheme().obtainStyledAttributes(new int[] {
android.R.attr.colorBackground,
android.R.attr.textColorPrimary,
});
int backgroundColor = array.getColor(0, 0xFF00FF);
int textColor = array.getColor(1, 0xFF00FF);
array.recycle();
Per Sfondo
TypedArray array = context.getTheme().obtainStyledAttributes(new int[] {
android.R.attr.windowBackground});
int backgroundColor = array.getColor(0, 0xFF00FF);
array.recycle();
view.setBackgroundColor(backgroundColor);
Grazie mille. – arcs