Skip to content

Commit

Permalink
Collapsing Toolbar added and is working fine. Additional changes:
Browse files Browse the repository at this point in the history
1. tried floating button to place in center
Rest is spacing etc.
  • Loading branch information
hishamMuneer committed Jun 10, 2015
1 parent fbee037 commit dfafebe
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,12 @@ public void onClick(View v) {

parentLayoutCo = findViewById(R.id.parentLayout);




floatingButtonCo.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Snackbar.make(coordinatorLayout, "You clicked on floating button.", Snackbar.LENGTH_LONG).show();
}
});



}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,11 @@ protected void onCreate(Bundle savedInstanceState) {
floatingButon.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Snackbar snackbar = Snackbar.make(parentLayout, "You just clicked",Snackbar.LENGTH_LONG);
final Snackbar snackbar = Snackbar.make(parentLayout, "You just clicked", Snackbar.LENGTH_LONG);
// snackbar.setDuration(10);
snackbar.setAction("Dismiss", new View.OnClickListener() {
@Override
public void onClick(View v) {
public void onClick(View v1) {
snackbar.dismiss();
}
});
Expand Down
38 changes: 38 additions & 0 deletions app/src/main/res/layout/floating_center_button.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<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:id="@+id/parentLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hisham.design.FloatingActionButtonActivity">


<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:src="@drawable/tulips" />

<ImageView
android:id="@+id/image2"
android:layout_width="wrap_content"
android:layout_height="300dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_below="@+id/imageView"
android:src="@drawable/koala" />

<android.support.design.widget.FloatingActionButton
android:id="@+id/floatingButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_anchor="@id/imageView"
app:layout_anchorGravity="bottom|right|end"
android:src="@mipmap/ic_action">
<!--android:fabSize="mini"-->
</android.support.design.widget.FloatingActionButton>


</RelativeLayout>

0 comments on commit dfafebe

Please sign in to comment.