Вот изображение моей пользовательской панели действий:Android: Пользовательская панель действий, Как использовать всю ширину?
Я хочу использовать всю ширину, у меня есть поиск в Интернете для решения, но ничего не wotrked для меня.
Вот мое действие бар .xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent">
<ImageView
android:layout_width="50dp"
android:layout_height="match_parent"
android:id="@+id/invActionBarSave"
android:src="@drawable/ic_ok_b"
android:nestedScrollingEnabled="true"
android:layout_alignParentRight="true"
android:background="#ffb0afaf"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" />
<ImageView
android:layout_width="50dp"
android:layout_height="match_parent"
android:id="@+id/invActionBarDelete"
android:src="@drawable/ic_trash"
android:nestedScrollingEnabled="true"
android:layout_toLeftOf="@+id/invActionBarSave"
android:layout_marginRight="5dp"
android:background="#ffb0afaf"
android:paddingLeft="8dp"
android:paddingRight="8dp"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:singleLine="true"
android:text="אלסאדק אחמד אבו האני"
android:textSize="18dp"
android:textColor="#ff000000"
android:id="@+id/invActionBarTitle"
android:gravity="center|right"
android:layout_toLeftOf="@+id/invActionBarDelete"
android:layout_toRightOf="@+id/invActionBarHome"
android:layout_marginRight="20dp"
android:layout_marginLeft="10dp" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/invActionBarHome"
android:src="@drawable/ic_back_b"
android:nestedScrollingEnabled="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="false"
android:paddingLeft="10dp" />
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:indeterminateOnly="false"
style="@style/ProgressBar.Horizontal"
android:indeterminate="true"
android:id="@+id/invActionBarProgressBar"
android:visibility="gone"
android:layout_below="@+id/invActionBarDelete"
android:paddingLeft="10dp" />
</RelativeLayout>
А вот мой Java-код:
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().setDisplayShowTitleEnabled(false);
LayoutInflater mInflater = LayoutInflater.from(this);
//View mCustomView = mInflater.inflate(R.layout.actionbar_invoice, null);
getSupportActionBar().setCustomView(R.layout.actionbar_invoice);
getSupportActionBar().setDisplayShowCustomEnabled(true);
setContentView(R.layout.cstmrinvoice);
getWindow().
getDecorView().
setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
[EDIT]
Вот простой на е:
А вот .xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:contentInsetEnd="0dp"
android:contentInsetStart="0dp">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:text="Small Text"
android:id="@+id/textView6"
android:background="#ffff0000"
android:textColor="#ffffffff" />
</RelativeLayout>
Тот же результат, есть еще пространство справа от панели действий!
Спасибо
BOOOOOM, thaaaaank вы очень барахло, он работает !! :-) Я очень ценю вашу помощь, еще раз спасибо – user2005049
где я должен положить эту панель инструментов, чтобы она помещала тени на мои предметы ?! – Kenji
Эй @ Амрут Бидри! Я столкнулся с той же проблемой на Android M и, похоже, что workaroung с «setContentInsetsAbsolute (0, 0)» работает только с Lolipop, но теперь он работает на Android M :(Знаете ли вы что-нибудь об этом? – Samik