这里有一个framelayout周围的方形边框,我想在点击监听器上删除它 请为此提出任何合适的解决方案。
ivFetchimage.setImageBitmap(bitmap);
StickerImageView iv_sticker = new StickerImageView(getApplicationContext());
iv_sticker.setImageDrawable(ivFetchimage.getDrawable());
int getScreenWidth = Other.getScreenWidth(getApplicationContext()) / 2;
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(getScreenWidth, getScreenWidth);
params.gravity = Gravity.CENTER;
iv_sticker.setLayoutParams(params);
frameLayoutcanvas.removeAllViews();
frameLayoutcanvas.addView(iv_sticker);
frameLayoutcanvas.setVisibility(View.VISIBLE);
frameLayoutcanvas.bringToFront();
这里有我的xml代码
<FrameLayout
android:id="@+id/vg_canvas"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:id="@+id/fetchimage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="fitXY"
android:src="@drawable/profile" />
</FrameLayout>
答案 0 :(得分:0)
@chiragdulera这是我的意思:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<yourFrameLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</yourFrameLayout>
<View
android:id="@+id/borderView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/transparent_background_outlet" />
</RelativeLayout>
drawable transparent_background_outlet看起来像:
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#00000000" />
<stroke android:color="#000000" android:width="2dp"/>
</shape>
现在设置可见或不可见的borderView,取决于你。