Quiero cambiar el color blanco del texto a naranja.Android - ActionBarSherlock - Establecer textcolor del texto en el menú
Aquí hay un ejemplo.
Quiero cambiar el color blanco del texto a naranja.Android - ActionBarSherlock - Establecer textcolor del texto en el menú
Aquí hay un ejemplo.
Esto se puede hacer mediante el establecimiento de algunos estilos de la barra de acción. Se explica en esta publicación de blog http://android-developers.blogspot.com.au/2011/04/customizing-action-bar.html
Debe configurar esto en su estilo para su aplicación.
<style name="MyTheme" parent="android:style/Theme.Holo.Light">
<item name="android:dropDownListViewStyle">@style/MyDropDownListView</item>
</style>
Luego puede especificar este estilo con su propio color de texto.
<!-- style the items within the overflow menu -->
<style name="MyDropDownListView" parent="android:style/Widget.Holo.ListView.DropDown">
<!-- This is the orange text color -->
<item name="android:textColor">#CC3232</item>
</style>
presente ningún cambio textColor, único color Backgorund
Se puede cambiar el color del texto MenuItem
fácilmente mediante el uso SpannableString
en lugar de String
.
@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
inflater.inflate(R.menu.your_menu, menu);
int positionOfMenuItem = 0; // or whatever...
MenuItem item = menu.getItem(positionOfMenuItem);
SpannableString s = new SpannableString("My red MenuItem");
s.setSpan(new ForegroundColorSpan(Color.RED), 0, s.length(), 0);
item.setTitle(s);
}
Bueno, esto realmente no funciona para mí. Un elemento DropDown aquí solo tiene selectores de fondo. – redestructa
¡Funciona para mí! De hecho, me estoy desarrollando en Xamarin Android y he estado buscando por todas partes esta solución. Después de innumerables búsquedas en google, finalmente tropecé con esto y lo intenté, y funcionó a las mil maravillas. No sabes lo bien que se siente que ese submenú finalmente se vuelva azul jaja. – TeamChillshot