Floating Action Button colour [duplicate] - android

This question already has answers here:
Set FAB icon color
(18 answers)
Closed 4 years ago.
I am using one of the preset button designs (an add button) for my FAB. I was able to change the colour of the background colour of the button but the plus is green and I want to change that. How can I change that?

Using
android:tint
property you can set the color like this
<android.support.design.widget.FloatingActionButton
android:id="#+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:tint="#android:color/white"
android:src="#android:drawable/ic_input_add" />
Hope this helps. Good luck :)

Related

floating action button not showing image [duplicate]

This question already has answers here:
error: package android.support.design.widget does not exist
(4 answers)
Closed 4 years ago.
I've added xml code to have a floating action button on my screen (no functionality right now but will) but when I go onto the design view of xml, instead of showing the email icon image, it shows just text like 'floating action button': '
Could someone explain what I've done wrong?
the code I use:
<android.support.design.widget.FloatingActionButton
android:id="#+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#android:drawable/ic_dialog_email"
android:layout_gravity="bottom|end"
app:elevation="6dp"
app:pressedTranslationZ="12dp"/>
It means the correct library is not added. Try adding design library
implementation 'com.android.support:design:27.1.1'

How to add dyanmic circular borders to imageview like whatsapp [duplicate]

This question already has answers here:
How to represent circle border with multiple colors in android
(3 answers)
Closed 5 years ago.
Please guide me to add dynamic dotted border to image view like whatsapp doing in status screen, Kindly see the below image, I circled the functionality of that I want to achieve,
Whatsapp Status Screen
You can try CircularImageView. You can dynamically change borders. Maybe you'il have to make some arrangements. You can look at example project.
Example.
<com.mikhaellopez.circularimageview.CircularImageView
android:layout_width="250dp"
android:layout_height="250dp"
android:src="#drawable/image"
app:civ_border_color="#EEEEEE"
app:civ_border_width="4dp"
app:civ_shadow="true"
app:civ_shadow_radius="10"
app:civ_shadow_color="#8BC34A"/>

TextInputEditText not showing drawableRight icon [duplicate]

This question already has answers here:
Unable to use drawable in EditText inside TextInputLayout
(5 answers)
Closed 6 years ago.
I am using code bellow to display User name Input. EditText is working properly but Right side display icon is not visible.
<android.support.design.widget.TextInputLayout
android:id="#+id/login_screen_edit_text_username_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.TextInputEditText
android:id="#+id/login_screen_edit_text_username"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="#string/label_username"
android:inputType="text"
android:drawableRight="#mipmap/email_icon"
android:text="abcd#gmail.com"
/>
</android.support.design.widget.TextInputLayout>
I am testing this code on Nexus6p android version 6.0. Parent layout is LinearLayout.Please update if anybody facing same issue and got fix for it.
use
android:drawableEnd="#mipmap/email_icon"
instead of
android:drawableRight="#mipmap/email_icon"

Make buttons work [duplicate]

This question already has answers here:
Button background as transparent
(15 answers)
Closed 6 years ago.
How do I add a button on a background image in Android?
I already added the background now I want to add a button and make it work within the background. I have tried to add multiple buttons but then they all don't work, I'm not sure if its the layout or something else.
This is what I have so far:
<Button
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="back"
android:id="#+id/button2"
android:layout_alignTop="#+id/button"
android:background="#drawable/scan1"
android:layout_centerHorizontal="true"
android:layout_alignParentStart="false"
android:layout_alignParentLeft="false" />
i edited the code, so the "scan1" drawable is showing red.
Use FancyButtons library to create buttons with transparent background. Set fb_defaultColor param as follows:
fancy:fb_defaultColor="#android:color/transparent"
Using this library, you won't lose ripple effects on button clicks.
You may also use: in your xml:
android:background="#null"
or in code:
button.setBackgroundColor(Color.TRANSPARENT);
Transparent button
android:background="#null"
or
android:background="#android:color/transparent"
android:background="?android:attr/selectableItemBackground"
Add this to your button xml.. Hope it helps

ImageButton in Android with transparent background [duplicate]

This question already has answers here:
How to have a transparent ImageButton: Android
(23 answers)
Closed 2 years ago.
I have follow this post to make ImageButton in android
android image button
The image appears to the button but it has some background , my Image is a png image and I want the button to be transparent background
any one help please
add this line to your ImageButton xml layout.
android:background="#null"
Here's an alternative solution that worked for me:
android:background="#android:color/transparent"
As Sunny said, add it to the ImageButtons' XML layout
In your code use this:
ImageButton btn = new ImageButton(this);
btn.setImageResource(R.drawable.btn_close);
btn.setBackgroundResource(0);
I don't know if there is any method to do that, but you can paint completely transparent .png file and use method setBackGroundResource() or in XML using this : android:background
By this way you can set transparent background to ImageButton:
<ImageButton android:id="#+id/imagebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="#drawable/<imageresourcename>"
android:background="#null"></ImageButton>

Categories

Resources