¿Cómo cambiar el tamaño del texto de la barra de herramientas?
Quiero cambiar el tamaño del texto en Toolbar
. Porque en mi aplicación, Toolbar
el texto tiene diferentes tamaños tanto para el modo horizontal como vertical.
¿Es posible cambiar el tamaño del texto en Toolbar
?
70
Author: Vukašin Manojlović, 2015-02-12
4 answers
Use titleTextAppearance :
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="?actionBarSize"
android:id="@+id/toolbar"
app:titleTextAppearance="@style/Toolbar.TitleText" />
Y sobrescribir el tamaño de título predeterminado en un estilo personalizado:
<style name="Toolbar.TitleText" parent="TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">18sp</item>
</style>
217
Author: Vukašin Manojlović,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-10 14:17:47
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-04-10 14:17:47
Por ejemplo, esta barra de herramientas
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimary"
android:gravity="center"
android:minHeight="?attr/actionBarSize"
app:theme="@style/ThemeOverlay.AppCompat.ActionBar" />
Usted puede simplemente añadir esto ver esto
app:titleTextAppearance="@style/yourstyle"
Estilo.xml
<style name="yourstyle" parent="@style/Base.TextAppearance.AppCompat.Title">
<item name="android:textSize">20sp</item>
</style>
Así...
17
Author: massaimara98,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-15 07:47:19
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-15 07:47:19
Puede agregar un TextView
a su barra de herramientas y personalizar como desee:
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent">
<TextView
android:id="@+id/toolbar_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name"
android:textSize="25sp"/>
</android.support.v7.widget.Toolbar>
3
Author: Simas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-12 20:42:18
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-02-12 20:42:18
Prueba esto en onCreate
:
android.support.v7.app.ActionBar actionbar = getSupportActionBar();
TextView textview = new TextView(MainActivity.this);
RelativeLayout.LayoutParams layoutparams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
textview.setLayoutParams(layoutparams);
textview.setText(getString(R.string.your_string));
textview.setTextColor(Color.WHITE);
textview.setTextSize(18);
actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
actionbar.setCustomView(textview);
Esto se toma de Android-Examples.com .
0
Author: MorZa,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-21 23:26:12
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-09-21 23:26:12