2017-10-07 97 views
-5

FloatingActionButton給熱鬧的粉紅色邊框,雖然我並不需要一個另外一個是我的,我有FloatingActionButton浮動操作按鈕,讓不必要的彩色邊框

enter image description here

enter image description here

條安裝原始圖片
<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.example.android.myapplication.MainActivity"> 

<ImageView 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_centerHorizontal="true" 
    android:layout_centerVertical="true" 
    android:src="@drawable/screen_logo"/> 
<LinearLayout 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:orientation="vertical" 
    android:layout_alignParentRight="true" 
    android:layout_alignParentBottom="true" 
    > 
    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/view" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/view" 
     android:layout_margin="5dp"/> 
    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/search" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin="5dp" 
     android:src="@drawable/search"/> 
    <android.support.design.widget.FloatingActionButton 
     android:id="@+id/add" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_margin='5dp' 
     android:src="@drawable/add"/> 
</LinearLayout> 

+4

分享你的XML佈局浮動操作按鈕 –

+1

附加代碼問題 –

回答

0

它不是0邊境

可以使用app:backgroundTint="@color/colorPrimary"改變backdround的FloatingActionButton

顏色或嘗試這一招用的Imageview代替FloatingActionButton

<ImageView 
    android:id="@+id/search" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:clickable="true" 
    android:src="@drawable/search" /> 

比你Activity.java

ImageView searchImageView = (ImageView) findViewById(R.id.search); 
searchImageView.setOnClickListener(new OnClickListener() { 
    public void onClick(View v) { 
    //perform your action here 
    } 
}); 
0

變化colorAccent到藍色210

或使用app:backgroundTint