floating-action-button

error when custom class extends FloatingActionButton

匆匆过客 提交于 2019-12-02 16:50:23
问题 I create a custom class and it extends FloatingActionButton public class customFAB extends FloatingActionButton { public customFAB(Context context) { super(context); } } I call this class from MainActivity customFAB cFab = new customFAB(getApplicationContext); But I get this error You need to use a Theme.AppCompat theme (or descendant) with the design library. my style.xml is <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!--

error: package android.support.design.widget does not exist

旧时模样 提交于 2019-12-02 16:19:21
问题 i'm new to android. when i want to import a project into my android studio it complain about this error that : error package android.support.design.widget does not exist here is my code : public class CatalogActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_catalog); // Setup FAB to open EditorActivity FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);

How we can put Floating action button on top of any layout

為{幸葍}努か 提交于 2019-12-02 16:11:20
问题 I am doing some operation on floating action button . I have a list view and showing google ad at bottom of my screen, The floating action button is showing at same place (bottom|end). so action button is hiding the ad. I want shift the Floating action button little above the ad linear layout. Please have a look the image: My code is look like: <android.support.design.widget.FloatingActionButton android:id="@+id/fab" android:layout_width="wrap_content" android:layout_height="wrap_content"

Floating Action Button expansion [closed]

橙三吉。 提交于 2019-12-02 15:16:38
According to the new Android Design Guidelines for the Floating Action Button, it should be reasonable to transform the Floating Action Button into a Toolbar . Are there any samples / examples to perform such a transformation? To use reveal animation you need add a onLayoutChange listener to the view in onCreateView callback like this: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment final View view = inflater.inflate(R.layout.fragment_map_list, container, false); if(Build.VERSION.SDK_INT >=

How to set gradient drawable as backgroundTint attribute on FloatingActionButton

▼魔方 西西 提交于 2019-12-02 13:12:05
问题 I would like to use a gradient color instead of the traditional solid color for a Floating Action Button. I already know how to modify the background color of the button, using ColorStateList . Is there a way to implement the following drawable as a background tint color? overlay.xml <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#c25f82" android:endColor="#5a3e60" android:angle="-270" /> </shape> 回答1: Yes, you can

error when custom class extends FloatingActionButton

余生长醉 提交于 2019-12-02 11:33:34
I create a custom class and it extends FloatingActionButton public class customFAB extends FloatingActionButton { public customFAB(Context context) { super(context); } } I call this class from MainActivity customFAB cFab = new customFAB(getApplicationContext); But I get this error You need to use a Theme.AppCompat theme (or descendant) with the design library. my style.xml is <resources> <!-- Base application theme. --> <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar"> <!-- Customize your theme here. --> <item name="colorPrimary">@color/colorPrimary</item> <item name=

Changing floating button image size programmatically

て烟熏妆下的殇ゞ 提交于 2019-12-02 10:31:23
I have floating button and image inside. And I need image to change size filling all space inside like here:| I tried different scale types but it did't work. I got this result for now. Finally I found the solution - maxImageSize. It worked, but now I need to set Fbutton size programmatically and I can't find the way to change maxImageSize in code. When you set the maxImageSize in the XML, you are changing the normal behavior and icon size of the FAB. <com.google.android.material.floatingactionbutton.FloatingActionButton android:adjustViewBounds="true" android:id="@+id/fab_main" android:layout

Rotating FloatingActionButton

Deadly 提交于 2019-12-02 08:45:53
I believe most of you all have seen the rotating FloatingActionButton in apps such as Google keep, push bullet and even Google inbox app. I am trying to achieve this rotation by having an animation file that is : <?xml version="1.0" encoding="UTF-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="135" android:pivotX="50%" android:pivotY="50%" android:repeatCount="0" android:fillAfter="true" android:fillEnabled="true" android:duration="100" /> Right now I am using makovkastar library to do this FAB button. However, when I set the

error: package android.support.design.widget does not exist

半腔热情 提交于 2019-12-02 08:21:10
i'm new to android. when i want to import a project into my android studio it complain about this error that : error package android.support.design.widget does not exist here is my code : public class CatalogActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_catalog); // Setup FAB to open EditorActivity FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent

Changing floating button image size programmatically

百般思念 提交于 2019-12-02 07:04:46
问题 I have floating button and image inside. And I need image to change size filling all space inside like here:| I tried different scale types but it did't work. I got this result for now. Finally I found the solution - maxImageSize. It worked, but now I need to set Fbutton size programmatically and I can't find the way to change maxImageSize in code. 回答1: When you set the maxImageSize in the XML, you are changing the normal behavior and icon size of the FAB. <com.google.android.material