2017-10-13 19 views
5

मेरे पास नक्शादृश्य युक्त घोंसला है, नक्शादृश्य को छोड़कर मुझे लगता है कि सभी विचार ओवरलैपिंग हैं। मेरे पास एक रीसाइक्लिंगव्यू भी है .. जो कट लेआउट के नीचे प्रदर्शित होता है, लेकिन इसमें नक्शा नहीं है।पेजर को देखने के लिए नक्शा ओवरलैप लेआउट कैसे बनाएं

स्क्रीनशॉट:

परिणाम मैं मिलता है:

enter image description here

और परिणाम मैं क्या उम्मीद:

enter image description here

मैं nagative मार्जिन स्थापित करने के साथ करने की कोशिश की है, लेकिन इसके लिए काम नहीं नक्शा देखें।

कोड: fragment_around.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.stratafy.activities.SignupActivity"> 

    <LinearLayout 
     android:clipToPadding="false" 
     android:layout_marginTop="160dp" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="vertical"> 

     <android.support.v4.view.ViewPager 
      android:id="@+id/viewpager" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" /> 


    </LinearLayout> 

    <RelativeLayout 
     android:id="@+id/background" 
     android:layout_width="match_parent" 
     android:layout_height="230dp" 
     android:background="@drawable/background_aroundme"> 

     <ProgressBar 
      android:id="@+id/mProgressbar" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true" 
      android:visibility="gone" /> 

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

      <android.support.design.widget.TabLayout 
       android:padding="0dp" 
       android:id="@+id/tabs" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginLeft="10dp" 
       android:layout_marginTop="50dp" 
       android:background="#00000000" 
       app:tabIndicatorColor="#00000000" 
       app:tabMode="fixed" 
       app:tabSelectedTextColor="@color/white" 
       app:tabTextAppearance="@style/CustomTextStyle2" 
       app:tabTextColor="@color/white" /> 

      <LinearLayout 
       android:gravity="center" 
       android:layout_gravity="center" 
       android:orientation="horizontal" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content"> 

       <LinearLayout 
        android:orientation="vertical" 
        android:layout_weight="1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

        <LinearLayout 
         android:orientation="vertical" 
         android:id="@+id/ll1" 
         android:gravity="center" 
         android:layout_gravity="center" 
         android:background="@color/colorAccent" 
         android:layout_width="50dp" 
         android:layout_height="2dp"></LinearLayout> 

       </LinearLayout> 

       <LinearLayout 
        android:orientation="vertical" 
        android:layout_weight="1" 
        android:layout_width="match_parent" 
        android:layout_height="match_parent"> 

        <LinearLayout 
         android:visibility="gone" 
         android:orientation="vertical" 
         android:id="@+id/ll2" 
         android:layout_gravity="center" 
         android:background="@color/colorAccent" 
         android:layout_width="50dp" 
         android:layout_height="2dp"></LinearLayout> 

       </LinearLayout> 

      </LinearLayout> 

     </LinearLayout> 

    </RelativeLayout> 

    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="65dp" 
     android:layout_below="@id/background" 
     android:layout_marginTop="-90dp" 
     android:orientation="vertical"> 

     <android.support.design.widget.FloatingActionButton 
      android:id="@+id/fab_filter" 
      android:src="@drawable/ic_filter" 
      app:fabSize="normal" 
      android:layout_marginRight="20dp" 
      android:layout_gravity="right" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 

    </LinearLayout> 


</RelativeLayout> 

मार्जिन टॉप = 160 शुरू जहां चल बटन .. और मेरे मानचित्र 240dp पर है।

fragment_map.xml

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/mapFragmentContainer" 
    android:layout_width="match_parent" 
    android:layout_marginTop="-70dp" 
    android:layout_height="match_parent" 
    android:orientation="vertical"> 


</FrameLayout> 

उत्तर

2

उपयोगकर्ता कटौती RelativeLayout

public class CutLayout extends FrameLayout { 
    private Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG); 
    private Xfermode pdMode = new PorterDuffXfermode(PorterDuff.Mode.CLEAR); 
    private Path path = new Path(); 

    public CutLayout(Context context) { 
     super(context); 
    } 

    public CutLayout(Context context, AttributeSet attrs) { 
     super(context, attrs); 
    } 

    public CutLayout(Context context, AttributeSet attrs, int defStyleAttr) { 
     super(context, attrs, defStyleAttr); 
    } 

    @TargetApi(Build.VERSION_CODES.LOLLIPOP) 
    public CutLayout(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { 
     super(context, attrs, defStyleAttr, defStyleRes); 
    } 

    @Override 
    protected void dispatchDraw(Canvas canvas) { 
     int saveCount = canvas.saveLayer(0, 0, getWidth(), getHeight(), null, Canvas.ALL_SAVE_FLAG); 
     super.dispatchDraw(canvas); 

     paint.setXfermode(pdMode); 
     path.reset(); 

     path.moveTo(0, getHeight()); 
     path.lineTo(getWidth(), getHeight()); 
     path.lineTo(getWidth(), getHeight() - TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 60, getResources().getDisplayMetrics())); 
     path.close(); 
     canvas.drawPath(path, paint); 

     canvas.restoreToCount(saveCount); 
     paint.setXfermode(null); 
    } } 

के बजाय और xml फ़ाइल में लेआउट

<com.helper.CutLayout 
     android:id="@+id/background" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 

     <ImageView 
      android:scaleType="fitXY" 
      android:src="@drawable/aroundme" 
      android:layout_width="match_parent" 
      android:layout_height="230dp" /> 
</com.helper.CutLayout> 
संबंधित मुद्दे