2017-02-15 234 views
0

enter image description here如何清除或刪除或不可見Framelayout的邊框線?

這裏有周圍的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

請幫我清除觸摸偵聽器上的邊框。 – chiragdulera

+0

我想你想邊界這個ImageView。而不是爲FrameLayout設置邊框,您可以使用RelativeLayout並添加1個更多的視圖重疊ImageView,然後爲此視圖設置邊框。現在,您可以爲此邊框視圖設置可見或不可見。 –

+0

我不能設置borderview到imageview我將不得不使用framelayout,因爲我做了,但現在我想隱藏邊框。 – chiragdulera

回答

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> 

並繪製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> 

現在設置可見或不可見b orderView,取決於你。

+0

是啊!多數民衆贊成用戶定義borderview,但我不想添加邊框我想刪除我與framelayout的邊界線。 – chiragdulera