Я хочу сделать панель действий чем-то вроде изображения, и я не знаю, как это сделать. Любая помощь в создании этого типа панели действий было бы здорово, особенно в той части, где название активности вместе с фономAndroid: Action Bar Styling
0
A
ответ
0
за звание быть ваши собственные изображения вы можете установить пользовательский макет,
getActionBar().setCustomView(R.layout.my_title_layout);
Где R.layout.my_title_layout является расположение для заголовка с фоном и текстом.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_gravity="center">
<TextView
android:id="@+id/mytext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/app_name"
android:textColor="@color/black"
android:textSize="22sp"
android:background="@drawable/title_background"/>
</LinearLayout>
Это будет иметь его по центру, вы можете установить фон с помощью формы Drawable, который я назвал title_background:
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/pink"/>
<stroke android:width="1dip" android:color="@color/pink" />
<corners android:radius="20dip"/>
<padding android:left="0dip" android:top="0dip" android:right="0dip" android:bottom="0dip" />
</shape>
Для установки шрифта Вы бы нужно настраиваемое представление или раздуть макет.
Смежные вопросы
- 1. Styling Android Action Bar
- 2. Styling your action bar android
- 3. Styling the Action Bar
- 4. Styling Spinner Action Bar
- 5. Styling Sherlock Action Bar
- 6. styling action bar использовать Theme.AppCompat
- 7. Styling Action Bar Цвет текста - Android
- 8. Styling the Action Bar в Android
- 9. Styling action bar в студии android
- 10. Styling Android action bar и компонент PullToRefresh
- 11. Styling Action Bar (цвет фона) Android
- 12. Styling Action Bar Overflow Menu background color
- 13. Шерлок Action Bar Styling (DropDown Spinner Navigation)
- 14. Использование BaseActivity для OnResume Action Bar Styling
- 15. Action Bar в Android
- 16. Android Action bar Изображение
- 17. Android UnityPlayerActivity Action Bar
- 18. Android action bar 'overlay'
- 19. Android Action bar
- 20. Android Action bar
- 21. Android action bar searchview
- 22. Android Action Bar Поиск
- 23. ACTION BAR AND ACTION BAR TABS PURE WHITE {ANDROID}
- 24. Android No Action Bar Glitch
- 25. Android 5.0 Tabhost action bar?
- 26. Action Bar Размер фона, Android
- 27. Android Action bar direction RTL
- 28. Android Studio Create Action Bar
- 29. Android Action Bar Up Button
- 30. Android Action Bar эллиптическая тень
Я не мог понять, что «название будет вашим собственным пользовательским изображением, которое вы можете установить для пользовательского вида» и как его разместить в центре панели действий? – LearningBasics
Я напишу пример один раз – Evan
просто интересно, это сработало? – Evan