2017-07-17 88 views
0

首先布局之外的按钮,看看这个screeshot:将我的DialogFragment

Screenshot

我希望把关闭按钮在这个模式是这样的: enter image description here

但我不知道该怎么做,这里是我的布局文件:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
tools:context="br.com.makadu.makaduevento.ui.fragments.wizardInteligenceArtificial.WizardAIFifthStep"> 


<android.support.constraint.ConstraintLayout 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 

    <TextView 
     android:id="@+id/tv_title_subjects_schedule_suggestion" 
     android:paddingTop="@dimen/screen_title_top_bot_padding" 
     android:paddingBottom="@dimen/screen_title_top_bot_padding" 
     android:background="@color/Verde2" 
     android:gravity="center_horizontal" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:textColor="@color/white" 
     android:textSize="@dimen/txt_medium" 
     android:text="@string/str_screen_title_subjects" 
     tools:layout_constraintTop_creator="1" 
     tools:layout_constraintRight_creator="1" 
     app:layout_constraintRight_toRightOf="parent" 
     tools:layout_constraintLeft_creator="1" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintTop_toTopOf="parent" /> 

    <TextView 
     android:text="@string/str_according_to_your_interests_title" 
     style="@style/Theme.DefaultTextView.PrimaryDark.Bold" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     tools:layout_constraintLeft_creator="1" 
     app:layout_constraintLeft_toLeftOf="parent" 
     android:id="@+id/tv_according_interests" 
     android:layout_marginTop="8dp" 
     app:layout_constraintTop_toBottomOf="@+id/tv_title_subjects_schedule_suggestion" /> 


    <ExpandableListView 
     android:id="@+id/elv_suggested_schedule" 
     android:layout_width="0dp" 
     android:layout_height="0dp" 
     android:layout_marginTop="8dp" 
     app:layout_constraintTop_toBottomOf="@+id/tv_according_interests" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintHorizontal_bias="0.0" 
     android:layout_marginBottom="8dp" 
     app:layout_constraintBottom_toTopOf="@+id/b_confirm_schedule"> 


    </ExpandableListView> 



    <Button 
     android:id="@+id/b_confirm_schedule" 
     style="@style/Theme.DefaultButton.Purple.Radius" 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:text="@string/str_confirm_schedule_button" 
     tools:layout_constraintLeft_creator="1" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintBottom_toBottomOf="parent" 
     android:layout_marginBottom="8dp" 
     android:layout_marginStart="8dp" 
     android:layout_marginLeft="8dp" 
     android:layout_marginRight="8dp" 
     app:layout_constraintRight_toRightOf="parent" 
     android:layout_marginEnd="8dp" /> 

</android.support.constraint.ConstraintLayout> 

在此先感谢。 以及stackoverflow是要求我解释更好的我的问题,但我想图片解释自我,所以我现在只是写任何没有意义的文本。

回答

0

第一个解决方案,它会工作100%,但我认为不漂亮:
您可以根布局透明,放在它需要看到的景色。 U可以设置OnClickListener作为根视图以隐藏可见视图中的对话框。
第二个解决方案,也许它会工作,我现在不能检查:
您可以关闭clipPadding根视图和移动哟关闭按钮出可见。
P.S.我从手机上写下来,所以没有好的视图格式和没有样本。

0

我对类似的问题有所了解,你应该创建一个LinearLayout使用具有背景透明度的重心和边距,将RelativeLayout添加到对话框的内容中。

在RelativeLayout的u可以使用的机器人:layout_alignParentRight =“真” &机器人:layout_alignParentTop =“真”包含关闭按钮的ImageView的(可能你也会需要使用一些利润太),所以这将是显示在包含对话框标题的文本视图上方。

我希望这对你有帮助,明天我会试着寄给你一个代码给你!