2

I am using a FloatingActionButton in my Layout:

<android.support.design.widget.FloatingActionButton
    android:layout_width="wrap_content"
    android:layout_height="61dp"
    android:clickable="true"
    app:fabSize="mini"
    android:src="@android:drawable/btn_star_big_off"
    android:id="@+id/floatingActionButton"
    app:layout_anchor="@+id/container"
    app:layout_anchorGravity="bottom|right"
    android:layout_gravity="start"
    android:layout_marginBottom="20dp"
    android:layout_marginEnd="20dp"
    android:layout_marginRight="20dp"
    app:backgroundTint="@color/colorAccent"
    />

I put an Image in it when the Activity is created:

favbtn = (FloatingActionButton) findViewById(R.id.floatingActionButton);
favbtn.setImageDrawable(ContextCompat.getDrawable(getApplicationContext(), btn_star_big_on));

When testing on an older Device, such as API 16, the Button is not showing/not visible. Is there a way to fix this?

  • 1
    Possible duplicate of [Floating Action Button for lower version](http://stackoverflow.com/questions/24605116/floating-action-button-for-lower-version) – shadygoneinsane Feb 17 '17 at 16:36
  • what is version of design library, you are using? – Ankur Khandelwal Feb 17 '17 at 16:40
  • dependencies: `dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:25.0.1' compile 'com.android.support:design:25.0.1' compile 'com.android.support:support-v4:25.0.1' compile 'com.google.android.gms:play-services-ads:9.8.0' testCompile 'junit:junit:4.12' }` – adriankroeger Feb 17 '17 at 16:45

1 Answers1

2

Fixed it with favbtn.bringToFront()