Добрый вечер. Появилось несколько вопросов. Вопрос 1. У меня есть кнопка. Ее код такой:
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/button_menu"/>
Файл button_menu:
<selector
xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#d1d4d3"/>
</shape>
</item>
</selector>
Кнопка рисуется, с этим все хорошо. В эту кнопку мне нужно впихнуть две маленькие картинки. Одну картинку справа и одну картинку слева. По середине должно быть место для текста. Текст задается программно - его размер неизвестен, т.е. он может быть как длинным, так и коротким.Получается, что положение картинки слева остается неизменным, а вот положение картинки справа зависит от длинны текста кнопки.
Вопрос 2. У меня есть popup menu. Как можно изменить цвет popup menu и его прозрачность? Как с обычной кнопкой не получается. Вот код popup menu:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/menu2"
android:title="О приложении"/>
<item
android:id="@+id/menu3"
android:title="Выйти из приложения"/>
</menu>
ОБНОВЛЕНО
<RelativeLayout
android:id="@+id/actionbar_button"
android:layout_width="wrap_content"
android:layout_height="54dp"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/button_menu" >
<ImageView
android:id="@+id/left_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:src="@drawable/image" />
<Button
android:id="@+id/button"
android:layout_toLeftOf = "@id/left_image"
android:singleLine = "true"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_toRightOf = "@+id/right_image"/>
<ImageView
android:id="@+id/right_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/image2"
android:layout_alignParentRight="true"/>
</RelativeLayout>
View cView = getLayoutInflater().inflate(R.layout.actionbar, null);
actionBar.setCustomView(cView);
Button button_actionbar = (Button) findViewById(R.id.actionbar_button);
Button button = (Button) findViewById(R.id.button);
button.setText("ТекстМеждуКнопками");
button_actionbar.setOnClickListener(viewClickListener);