我在我的一个Android应用程序中使用了bringToFront。我无法按照我的要求工作。有paint_view的id和rearrangeable_layout在我想要的时候工作正常,但即使我叫id sticker_view
带来前面....它来到前面但paint_view1
也留在前面,我能够画画。我希望将paint_view1
保留在sticker_view
后面。
我的XML视图如下所示
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/admob"
android:layout_below="@+id/appbar"
android:layout_alignParentTop="true"
android:layout_marginTop="?actionBarSize"
android:orientation="vertical"
android:visibility="visible">
<LinearLayout
android:id="@+id/lnr_draw"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1.0"
android:visibility="visible">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="vertical">
<com.example.myclass.cardmaker.PaintView
android:id="@+id/paint_view1"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<com.xiaopo.flying.sticker.StickerView
android:id="@+id/sticker_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/sticker_transparent_background"
app:borderAlpha="123"
app:borderColor="@android:color/black"
app:bringToFrontCurrentSticker="true"
app:showBorder="true"
app:showIcons="true">
</com.xiaopo.flying.sticker.StickerView>
<me.panavtec.drawableview.DrawableView
android:id="@+id/paintView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<ImageView
android:id="@+id/img_bg"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:background="@drawable/gradient14"
android:scaleType="fitCenter"
android:visibility="visible" />
<com.rajasharan.layout.RearrangeableLayout
android:id="@+id/rearrangeable_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
app:outlineColor="?attr/colorPrimaryDark"
app:selectionZoom="1.2"
app:outlineWidth="2dp">
<RelativeLayout
android:layout_centerHorizontal="true"
android:layout_centerInParent="true"
android:layout_centerVertical="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:padding="@dimen/lblTime"
android:id="@+id/text_quotes"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent"
android:gravity="center"
android:textStyle="bold"
android:textColor="?attr/colorPrimaryDark"
android:shadowRadius="0"
android:text="Text"
android:textSize="@dimen/newMainText" />
</RelativeLayout>
</com.rajasharan.layout.RearrangeableLayout>
<ImageView
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:id="@+id/fab"
android:tint="?attr/colorPrimaryDark"
android:layout_width="@dimen/nav_but_size"
android:layout_height="@dimen/nav_but_size"
android:layout_gravity="bottom|end"
android:layout_margin="@dimen/list_text_margin"
android:src="@drawable/ic_new_edit" />
</RelativeLayout>
</LinearLayout>
</LinearLayout>
我的呼叫bringToFront
的Java代码如下所示
stickerView.bringToFront();
stickerView.invalidate();
让我知道有人可以帮助我解决我的问题。感谢