2016-08-30 2 views
-3

Я пытаюсь добиться чего-то вроде этого:Часть кнопки вне Диалога

Check image

Кто-нибудь есть идеи о том, как сделать кнопку остаться частично вне диалога и быть всегда под текст?

Вот мой диалог раскладка:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:alpha="180" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginLeft="24dp" 
     android:layout_marginRight="24dp" 
     android:layout_marginTop="24dp" 
     android:background="@drawable/actionbar_selector" 
     android:orientation="vertical" 
     android:weightSum="1"> 

     <ImageView 
      android:id="@+id/imageView4" 
      android:layout_width="100dp" 
      android:layout_height="100dp" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="8dp" 
      android:src="@drawable/ic_error_outline" /> 

     <TextView 
      android:id="@+id/textView" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginTop="16dp" 
      android:text="@string/drive_carefully_title" 
      android:textAppearance="?android:attr/textAppearanceMedium" 
      android:textColor="@color/blue_light" /> 

     <TextView 
      android:id="@+id/textView6" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_horizontal" 
      android:layout_marginLeft="16dp" 
      android:layout_marginRight="16dp" 
      android:layout_marginTop="32dp" 
      android:text="@string/drive_carefully_message" 
      android:textAppearance="?android:attr/textAppearanceSmall" 
      android:textColor="@color/blue_light" /> 

     <TextView 
      android:id="@+id/ok_button" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:layout_gravity="center" 
      android:layout_marginBottom="16dp" 
      android:layout_marginTop="32dp" 
      android:layout_weight="0.18" 
      android:paddingBottom="8dp" 
      android:paddingLeft="16dp" 
      android:paddingRight="8dp" 
      android:paddingTop="8dp" 
      android:autoText="false" 
      android:background="@drawable/ok_button" 
      android:textColor="@color/blue_medium" 
      android:text="@string/ok" 
      android:textSize="24dp" 
      android:clickable="true" 
      android:layout_marginLeft="64dp" 
      android:gravity="center" 
      android:textStyle="bold"> 
     </TextView> 

    </LinearLayout> 

</RelativeLayout> 

А вот как это выглядит на данный момент:

enter image description here

+2

Опубликовать свой * xml * код. –

+0

Вы можете использовать собственный макет в полноэкранном режиме. Тогда пусть его граница будет ** прозрачной ** и сделать ее **, как **, кнопка выходит за пределы границы. –

+0

Почему у вас этот ** неиспользованный ** RelativeLayout? Вложенные макеты ** плохо для исполнения **. –

ответ

-1

Вы можете сделать это, как показано ниже, если у вас есть Drawable о том, что , Просто передайте, что Drawable ссылка ниже ImageView.

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@android:color/transparent" 
    android:orientation="vertical"> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_margin="25dp" 
     android:background="#111111"> 


     <!--Your rest of xml code--> 

    </LinearLayout> 


    <ImageView 
     android:layout_width="100dp" 
     android:layout_height="50dp" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:layout_alignParentEnd="true" 
     android:layout_marginBottom="50dp" 
     android:src="@drawable/logo" /> 

</RelativeLayout> 

Набор Height и Width из Image согласно вашему требованию.

+0

@ Downvoter снимает вашу причину для downvote здесь. я дал альтернативный способ добиться того, что задают в ОП. Стреляйте по своей причине, чтобы я мог улучшить. –

+0

Я не тот, что был downvoted, и я правильно ответил на ваш ответ, но я бы предложил одно улучшение. Если вы установите ImageView ниже LinearLayout и верхний край -50dp, Dialog не должен быть полноэкранным. Спасибо за помощь кстати. –

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