2017-11-08 22 views
0

Screen shot親のレイアウトの背景を非表示にする

これは警告ダイアログです。私は親レイアウトのバックグラウンドである灰色の部分(上部)を表示したくありません。代わりにその部分がはっきりしていなければならず、前のアクティビティはダイアログの外に表示されているようにそこに表示されるべきです。また、円形画像ビューの境界線は画像と密接な関係にある。それ、どうやったら出来るの?前もって感謝します。

Mylayout.xml

<ScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:card_view="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:background="#727272"> 

<RelativeLayout 
    android:id="@+id/card_container" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content"> 

    <android.support.v7.widget.CardView 
     android:id="@+id/card_save" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="50dp" 
     android:foreground="?android:attr/selectableItemBackground" 
     card_view:cardBackgroundColor="#ffffff" 
     card_view:cardCornerRadius="4dp" 
     card_view:cardElevation="0dp" 
     card_view:cardUseCompatPadding="false"> 

     <RelativeLayout 
      android:id="@+id/rl_bottom" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="10dp"> 


      <android.support.design.widget.TextInputLayout 
       android:id="@+id/til_date" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="60dp"> 
       <TextView 
        android:id="@+id/tv_date" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_below="@id/textView_DoB" 
        android:paddingTop="10dp" 
        android:paddingStart="10dp" 
        android:paddingEnd="10dp" 
        android:hint="@string/dd_mm_yyyy" 
        android:textColor="@android:color/black" 
        android:textAlignment="viewStart" 
        android:textSize="25sp" 
        android:background="@drawable/border_date"/> 

      </android.support.design.widget.TextInputLayout> 
      <ImageButton 
       android:id="@+id/ib_DoB_in_dialog" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignEnd="@id/til_date" 
       android:layout_marginTop="63dp" 
       android:layout_marginEnd="5dp" 
       android:background="@mipmap/calendar" 
       android:contentDescription="@string/calendar_image" /> 

      <TextView 
       android:id="@+id/textView_DoB_weekday" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_alignEnd="@id/til_date" 
       android:layout_marginTop="20dp" 
       android:layout_marginStart="10dp" 
       android:layout_marginEnd="10dp" 
       android:textColor="@android:color/black" 
       android:textAlignment="viewStart" 
       android:textSize="20sp" 
       /> 

      <android.support.design.widget.TextInputLayout 
       android:id="@+id/til_name" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/til_date" 
       android:layout_marginTop="10dp"> 
       <android.support.design.widget.TextInputEditText 
        android:id="@+id/et_name" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/name" 
        android:inputType="textCapWords" /> 
      </android.support.design.widget.TextInputLayout> 


      <android.support.design.widget.TextInputLayout 
       android:id="@+id/til_category" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/til_name" 
       android:layout_marginTop="10dp"> 
       <Spinner 
        android:id="@+id/sp_category" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:entries="@array/Category"> 
       </Spinner> 
      </android.support.design.widget.TextInputLayout> 




      <android.support.design.widget.TextInputLayout 
       android:id="@+id/til_mobile" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@+id/til_category" 
       android:layout_marginTop="10dp"> 
       <android.support.design.widget.TextInputEditText 
        android:id="@+id/et_mobile" 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:layout_marginTop="10dp" 
        android:hint="@string/mobile_number_optional" 
        android:inputType="number" 
        android:maxLength="13"/> 
      </android.support.design.widget.TextInputLayout> 

      <TableLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_below="@id/til_mobile" 
       android:layout_marginTop="10dp"> 
       <TableRow> 
        <Button 
         android:id="@+id/btn_discard" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_column="0" 
         android:layout_weight="1" 
         android:text="@string/discard" /> 

        <Button 
         android:id="@+id/btn_save_data" 
         android:layout_width="0dp" 
         android:layout_height="wrap_content" 
         android:layout_column="1" 
         android:layout_weight="1" 
         android:text="@string/save" /> 
       </TableRow> 
      </TableLayout> 


     </RelativeLayout> 

    </android.support.v7.widget.CardView> 

    <de.hdodenhof.circleimageview.CircleImageView 
     android:id="@+id/civ_profile_image" 
     android:layout_width="100dp" 
     android:layout_height="100dp" 
     android:layout_centerHorizontal="true" 
     android:src="@mipmap/ic_person_image" 
     card_view:civ_border_width="2dp" 
     card_view:civ_border_color="#ffffff"/> 

</RelativeLayout> 

+0

フラグメントを使用してそれらの間でスワップする。 – Zoe

+0

どうすればいいか教えていただけますか? – Cjsparrow

+0

ドキュメントを読むと、フラグメントはそこによく覆われています。 – Zoe

答えて

0

あなたの親XML

android:background="@android:color/transparent" 

にこれを追加し、全体の警告]ダイアログボックスが透明になるので、あなたのコードにこれを追加し

alertDialog.getWindow().setDimAmount(0); 
+0

はい、しかしダイアログ全体の背景が白くなり、私はそれを望ましくありません。灰色の部分を除いて、画像の半分の部分が白い部分の上にくるようにします。 – Cjsparrow

+0

私の回答を更新しました。アラートダイアログのデフォルトの色は白です。 – Boukharist

+0

アラートダイアログに透明でない問題があります。 もっと見るhttps://stackoverflow.com/questions/25174165/transparent-alertdialog-has-black-背景 – Boukharist

関連する問題