2015-02-05 4 views
0

Как изменить цвет полей, отделяющих кнопки предупреждения (положительные и отрицательные)?Изменить цвет «полей» на кнопках оповещения

Это то, что я хочу изменить:

http://imgur.com/BrIa5DB

(Cant долбанные загружать изображения из-за репутации)

Спасибо!

EDIT

То, что я сейчас:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:orientation="vertical" 
android:layout_width="wrap_content" 
android:layout_height="wrap_content" 
android:background="#80000000" 
> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:gravity="center|bottom" 
    android:layout_margin="10dp"> 

    <ImageView 
     android:layout_width="100px" 
     android:layout_height="100px" 
     android:src="@drawable/more_info_icon"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:paddingBottom="10dp" 
     android:paddingLeft="20dp" 
     android:gravity="center_vertical" 
     android:text="More Information" 
     android:textColor="#000000" 
     android:textStyle="bold" 
     android:textSize="20dp"/> 

    </LinearLayout> 

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:text="@string/alert_dialog_text_1" 
    android:layout_margin="@dimen/alert_margin" 
    android:textColor="#000000"/> 

<TextView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:gravity="center" 
    android:text="@string/alert_dialog_text_2" 
    android:layout_marginBottom="11dp" 
    android:textColor="#000000"/> 

и

builder.setView(inflater.inflate(R.layout.custom_alert_dialog, null)); 
builder.setPositiveButton(...); 
builder.setNegativeButton(...); 
Button negB = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_NEGATIVE); 
Button posB = ((AlertDialog) dialog).getButton(DialogInterface.BUTTON_POSITIVE); 
negB.setBackgroundColor(Color.parseColor("#80000000")); 
posB.setBackgroundColor(Color.parseColor("#80000000")); 

ответ

0

Вы не можете изменить цвет маржу, но то, что вы можете сделать, это обертка содержимое в новой линейной компоновке и изменение b ackground цвет этого!

here is an example:

кстати тени на кнопках обыкновение появляться при запуске приложения.

и код:

<?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:gravity="center" 
    android:background="#fff"> 

    <LinearLayout 
     android:orientation="horizontal" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:background="#ffff0000" 

     > 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginRight="10dp" 
      android:background="#000" 
      android:text="BUTTON1" 
      android:textColor="#fff" /> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginLeft="10dp" 
      android:background="#000" 
      android:text="BUTTON2" 
      android:textColor="#fff" /> 

    </LinearLayout> 

</LinearLayout> 
+0

Просто, чтобы быть уверенным, таким образом, я не могу использовать .setPositiveButton и .setNegativeButton, или я могу? Если смогу, как мне это сделать? Поля отображаются, потому что добавлены кнопки. Они не находятся в исходном файле Layout – GuiFGDeo

+0

, вы измените цвет линейного макета –

+0

Я обновлю свой вопрос, чтобы показать, что у меня уже есть ... Я считаю, что я не мог это объяснить. – GuiFGDeo

Смежные вопросы