FloatingActionButton showing two colors (circles)
up vote
0
down vote
favorite
I added a FloatingActionButton in the layout where its only parent is a CoordinatorLayout, so I don't understand where the backgroundTint color is coming from.
I tried to change the color to match the inner circle, but it changes the whole button to a solid color.
I also applied a different style, but it does not change the button at all.
I fixed this problem in the past, but I don't remember how I did it.
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end" />
android
add a comment |
up vote
0
down vote
favorite
I added a FloatingActionButton in the layout where its only parent is a CoordinatorLayout, so I don't understand where the backgroundTint color is coming from.
I tried to change the color to match the inner circle, but it changes the whole button to a solid color.
I also applied a different style, but it does not change the button at all.
I fixed this problem in the past, but I don't remember how I did it.
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end" />
android
What is your desired color for FAB and inside icon? Gray FAB with crimson icon or reverse?
– aminography
Nov 11 at 6:15
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I added a FloatingActionButton in the layout where its only parent is a CoordinatorLayout, so I don't understand where the backgroundTint color is coming from.
I tried to change the color to match the inner circle, but it changes the whole button to a solid color.
I also applied a different style, but it does not change the button at all.
I fixed this problem in the past, but I don't remember how I did it.
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end" />
android
I added a FloatingActionButton in the layout where its only parent is a CoordinatorLayout, so I don't understand where the backgroundTint color is coming from.
I tried to change the color to match the inner circle, but it changes the whole button to a solid color.
I also applied a different style, but it does not change the button at all.
I fixed this problem in the past, but I don't remember how I did it.
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end" />
android
android
asked Nov 11 at 3:10
pitos
417
417
What is your desired color for FAB and inside icon? Gray FAB with crimson icon or reverse?
– aminography
Nov 11 at 6:15
add a comment |
What is your desired color for FAB and inside icon? Gray FAB with crimson icon or reverse?
– aminography
Nov 11 at 6:15
What is your desired color for FAB and inside icon? Gray FAB with crimson icon or reverse?
– aminography
Nov 11 at 6:15
What is your desired color for FAB and inside icon? Gray FAB with crimson icon or reverse?
– aminography
Nov 11 at 6:15
add a comment |
2 Answers
2
active
oldest
votes
up vote
1
down vote
accepted
The gray color comes from your colorAccent
defined for the app theme in style.xml
. Now the @drawable/ic_action_add
is a plus sign inside a filled circle. Try to use below icon instead:
ic_add_black_24dp.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector>
Then set a crimson color to the FloatingActionButton
's background tint and the gray one for icon tint:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:tint="#404D54"
app:backgroundTint="#6F303A"
app:srcCompat="@drawable/ic_add_black_24dp" />
Result:
add a comment |
up vote
0
down vote
You are not providing any app:backgroundTint
, so it is using the default colorAccent
from colors.xml.
To solve this:
1.Add a new color to colors.xml
<color name="fab_tint">#33d1ac</color>
2.Change the code as follows:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:backgroundTint="@color/fab_tint"/>
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
The gray color comes from your colorAccent
defined for the app theme in style.xml
. Now the @drawable/ic_action_add
is a plus sign inside a filled circle. Try to use below icon instead:
ic_add_black_24dp.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector>
Then set a crimson color to the FloatingActionButton
's background tint and the gray one for icon tint:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:tint="#404D54"
app:backgroundTint="#6F303A"
app:srcCompat="@drawable/ic_add_black_24dp" />
Result:
add a comment |
up vote
1
down vote
accepted
The gray color comes from your colorAccent
defined for the app theme in style.xml
. Now the @drawable/ic_action_add
is a plus sign inside a filled circle. Try to use below icon instead:
ic_add_black_24dp.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector>
Then set a crimson color to the FloatingActionButton
's background tint and the gray one for icon tint:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:tint="#404D54"
app:backgroundTint="#6F303A"
app:srcCompat="@drawable/ic_add_black_24dp" />
Result:
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
The gray color comes from your colorAccent
defined for the app theme in style.xml
. Now the @drawable/ic_action_add
is a plus sign inside a filled circle. Try to use below icon instead:
ic_add_black_24dp.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector>
Then set a crimson color to the FloatingActionButton
's background tint and the gray one for icon tint:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:tint="#404D54"
app:backgroundTint="#6F303A"
app:srcCompat="@drawable/ic_add_black_24dp" />
Result:
The gray color comes from your colorAccent
defined for the app theme in style.xml
. Now the @drawable/ic_action_add
is a plus sign inside a filled circle. Try to use below icon instead:
ic_add_black_24dp.xml
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#000000"
android:pathData="M19,13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z" />
</vector>
Then set a crimson color to the FloatingActionButton
's background tint and the gray one for icon tint:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:tint="#404D54"
app:backgroundTint="#6F303A"
app:srcCompat="@drawable/ic_add_black_24dp" />
Result:
edited Nov 11 at 10:07
answered Nov 11 at 5:15
aminography
3,33311129
3,33311129
add a comment |
add a comment |
up vote
0
down vote
You are not providing any app:backgroundTint
, so it is using the default colorAccent
from colors.xml.
To solve this:
1.Add a new color to colors.xml
<color name="fab_tint">#33d1ac</color>
2.Change the code as follows:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:backgroundTint="@color/fab_tint"/>
add a comment |
up vote
0
down vote
You are not providing any app:backgroundTint
, so it is using the default colorAccent
from colors.xml.
To solve this:
1.Add a new color to colors.xml
<color name="fab_tint">#33d1ac</color>
2.Change the code as follows:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:backgroundTint="@color/fab_tint"/>
add a comment |
up vote
0
down vote
up vote
0
down vote
You are not providing any app:backgroundTint
, so it is using the default colorAccent
from colors.xml.
To solve this:
1.Add a new color to colors.xml
<color name="fab_tint">#33d1ac</color>
2.Change the code as follows:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:backgroundTint="@color/fab_tint"/>
You are not providing any app:backgroundTint
, so it is using the default colorAccent
from colors.xml.
To solve this:
1.Add a new color to colors.xml
<color name="fab_tint">#33d1ac</color>
2.Change the code as follows:
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"
android:src="@drawable/ic_action_add"
app:layout_anchor="@+id/edit_layout"
app:layout_anchorGravity="bottom|right|end"
app:backgroundTint="@color/fab_tint"/>
answered Nov 11 at 5:40
Touhidul Islam
331110
331110
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245523%2ffloatingactionbutton-showing-two-colors-circles%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What is your desired color for FAB and inside icon? Gray FAB with crimson icon or reverse?
– aminography
Nov 11 at 6:15