2017-07-27 2 views
1

Im einen übergeordneten Layout RelativeLayout innerhalb ScrollView habe, die am Ende der RelativeLayout mehr Kind-Layout und ein Kind Layout (dh preview_wrapper) enthält, die mit match_parentLayoutParam der es füllt und enthalten einen Hintergrund mit Alpha-Farbe und seine clickable und focusable ist auf True festgelegt, so dass keine Ansicht innerhalb des übergeordneten Layouts anklickbar ist. aber es funktioniert nicht für mich Ich bin nicht in der Lage zu sehen, das letzte Kind füllen das Eltern-Layout nach vorne bringen. aber wenn ich entferne ScrollView seine Arbeit perfekt .. aber ich muss es innerhalb ScrollView bringen, wie ich die preview_wrapper außerhalb der ScrollView bin ich nicht in der Lage, das Layout zu scrollen.kann nicht innerhalb Scroll Kind Layout füllt seine Eltern machen

Struktur:

<ScrollView> 
    <RelativeLayout> 
     <LinearLayout> 
     </LinearLayout> 

     <!-- the layout I want to bring in front of above linear layout and cover its parent --> 
     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/alpha_white" 
      android:clickable="true" 
      android:focusable="true" 
      android:id="@+id/preview_wrapper" 
      ></RelativeLayout> 


    </RelativeLayout> 

</ScrollView> 

XML:

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

    <ScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

    <RelativeLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
     <LinearLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:weightSum="4" 
      android:layout_below="@+id/car_pager" 
      android:orientation="horizontal" 
      android:id="@+id/action_wrap" 
      > 
      <RelativeLayout 
       android:layout_width="0dp" 
       android:layout_weight="1" 
       android:layout_height="wrap_content" 
       android:id="@+id/action_save" 
       android:background="@drawable/btn_action_selector" 
       android:clickable="true" 
       android:focusable="true" 
       android:paddingTop="20dp" 
       android:paddingBottom="20dp" 

       > 
       <LinearLayout 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerInParent="true" 
        android:orientation="vertical" 
        > 
        <ImageView 
         android:layout_width="15dp" 
         android:layout_height="15dp" 
         android:src="@drawable/ic_star_hollow" 

         android:tint="@color/white" 
         android:id="@+id/ic_save" 
         android:layout_gravity="center" 
         /> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textSize="12sp" 
         android:textColor="@color/white" 
         android:text="@string/save" 
         android:textAllCaps="false" 
         android:layout_marginTop="10dp" 

         /> 
       </LinearLayout> 



      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:id="@+id/action_email" 
       android:layout_weight="1" 
       android:background="@drawable/btn_action_selector" 
       android:clickable="true" 
       android:focusable="true" 
       android:paddingTop="20dp" 
       android:paddingBottom="20dp" 
       > 
       <LinearLayout 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerInParent="true" 
        android:orientation="vertical" 
        > 

        <ImageView 
         android:layout_width="15dp" 
         android:layout_height="15dp" 
         android:src="@drawable/ic_email_action" 
         android:layout_centerInParent="true" 
         android:tint="@color/white" 
         android:layout_gravity="center" 
         /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textSize="12sp" 
         android:textColor="@color/white" 
         android:text="@string/contact" 
         android:textAllCaps="false" 
         android:layout_marginTop="10dp" 
         /> 


       </LinearLayout> 

      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:id="@+id/action_price_alert" 
       android:layout_weight="1" 
       android:background="@drawable/btn_action_selector" 
       android:clickable="true" 
       android:focusable="true" 
       android:paddingTop="20dp" 
       android:paddingBottom="20dp" 
       > 
       <LinearLayout 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerInParent="true" 
        android:orientation="vertical" 
        > 

        <ImageView 
         android:layout_width="15dp" 
         android:layout_height="15dp" 
         android:src="@drawable/ic_electric" 
         android:layout_centerInParent="true" 
         android:tint="@color/white" 
         android:id="@+id/price_alt_btn" 
         android:layout_gravity="center" 
         /> 

        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textSize="12sp" 
         android:textColor="@color/white" 
         android:text="@string/price_alert" 
         android:textAllCaps="false" 
         android:layout_marginTop="10dp" 
         /> 

       </LinearLayout> 

      </RelativeLayout> 

      <RelativeLayout 
       android:layout_width="0dp" 
       android:layout_height="match_parent" 
       android:id="@+id/action_flag" 
       android:layout_weight="1" 
       android:background="@drawable/btn_action_selector" 
       android:clickable="true" 
       android:focusable="true" 
       android:paddingTop="20dp" 
       android:paddingBottom="20dp" 

       > 

       <LinearLayout 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_centerInParent="true" 
        android:orientation="vertical" 
        > 

        <ImageView 
         android:layout_width="15dp" 
         android:layout_height="15dp" 
         android:src="@drawable/ic_flag_hollow" 
         android:layout_centerInParent="true" 
         android:tint="@color/white" 
         android:layout_gravity="center" 
         /> 
        <TextView 
         android:layout_width="wrap_content" 
         android:layout_height="wrap_content" 
         android:textSize="12sp" 
         android:textColor="@color/white" 
         android:text="@string/abuse_report" 

         android:layout_marginTop="10dp" 
         android:textAllCaps="false" 
         /> 

       </LinearLayout> 
      </RelativeLayout> 

     </LinearLayout> 
     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/alpha_white" 
      android:clickable="true" 
      android:focusable="true" 
      android:id="@+id/preview_wrapper" 
      ></RelativeLayout> 

    </RelativeLayout> 


    </ScrollView> 

</RelativeLayout> 

Antwort

1

Dann machen die RelativeLayout in ein FrameLayout und das Kind Layout neu anordnen, wie hier

gezeigt
<ScrollView> 
    <FrameLayout> 

     <!-- the layout I want to bring in front of above linear layout and cover its parent --> 

     <RelativeLayout 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:background="@color/alpha_white" 
      android:clickable="true" 
      android:focusable="true" 
      android:id="@+id/preview_wrapper" 
      ></RelativeLayout> 

     <LinearLayout> 
     </LinearLayout> 
    </FrameLayout> 

</ScrollView> 
+0

Dank i kämpfte so lange mit –

+0

Sie sind willkommen @MehvishAli –

Verwandte Themen