ActionBar. Set custom view

Интерфейс, диалоги, темы, стили, меню
Ответить
ANdriy123456
Сообщения: 138
Зарегистрирован: 27 июн 2014, 01:41

ActionBar. Set custom view

Сообщение ANdriy123456 » 20 июл 2015, 18:20

Как удалить часть старого "actionbar" после setCustomView?

код java:

Код: Выделить всё

ActionBar actionBar = getActionBar();
        actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
        actionBar.setDisplayShowCustomEnabled(true);
        actionBar.setCustomView(R.layout.custom_ab);
код custom_ab.xml

Код: Выделить всё

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/top_green">
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center">
    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/ab_menu"
        android:padding="10dp"
        android:src="@mipmap/menu_icon" />

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="@string/app_name"
        android:id="@+id/textView"
        android:textColor="@color/white"
        android:layout_weight="1"
        android:gravity="center"
        android:singleLine="true"
        android:layout_marginLeft="10dp" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/imageView3"
        android:src="@mipmap/search_icon"
        android:padding="10dp" />

    </LinearLayout>
</LinearLayout>
Вложения
Screenshot_2015-07-20-18-11-19.png
Screenshot_2015-07-20-18-11-19.png (223.5 КБ) 1975 просмотров

Dark67
Сообщения: 72
Зарегистрирован: 23 июл 2012, 23:11

Re: ActionBar. Set custom view

Сообщение Dark67 » 20 июл 2015, 18:40


Ответить