package com.ufreedom.demo;

import android.graphics.Color;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.TextView;

import com.ufreedom.floatingview.Floating;
import com.ufreedom.floatingview.FloatingBuilder;
import com.ufreedom.floatingview.FloatingElement;
import com.ufreedom.floatingview.effect.TranslateFloatingTransition;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final Floating floatingView = new Floating(this);

        final View normalView = findViewById(R.id.normalView);


        assert normalView != null;
        normalView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                TextView textView = new TextView(MainActivity.this);
                textView.setBackgroundColor(Color.RED);
                textView.setText("UFreedom");
                FloatingElement builder = new FloatingBuilder().anchorView(view)
                        .floatingTransition(new TranslateFloatingTransition())
                        .target(textView).build();
                floatingView.startFloating(builder);
            }
        });
        
        
        View curveView = findViewById(R.id.curveView);

        assert curveView != null;
        curveView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
            }
        });

        View scaleView = findViewById(R.id.scaleView);


        assert scaleView != null;
        scaleView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                TextView textView = new TextView(MainActivity.this);
                textView.setBackgroundColor(Color.RED);
                textView.setText("UFreedom");
                FloatingElement builder = new FloatingBuilder().anchorView(view)
                        .target(textView).build();
                floatingView.startFloating(builder);
            }
        });
    }
}

@@ -147,20 +147,149 @@
 id.view.
-View
+Gravity;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.ImageView;%0Aimport android.widget.LinearLayout
 ;%0Aimport
@@ -1734,32 +1734,1102 @@
 ck(View view) %7B%0A
+                LinearLayout linearLayout = new LinearLayout(MainActivity.this);%0A                linearLayout.setOrientation(LinearLayout.HORIZONTAL);%0A                ImageView imageView = new ImageView(MainActivity.this);%0A                imageView.setImageDrawable(getResources().getDrawable(R.mipmap.ic_launcher));%0A                linearLayout.addView(imageView);%0A%0A                TextView textView = new TextView(MainActivity.this);%0A                textView.setBackgroundColor(Color.RED);%0A                textView.setText(%22UFreedom%22);%0A                LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);%0A                layoutParams.gravity = Gravity.CENTER_VERTICAL;%0A                linearLayout.addView(textView,layoutParams);%0A%0A                FloatingElement builder = new FloatingBuilder().anchorView(view)%0A                        .target(linearLayout).floatingTransition(new TranslateFloatingTransition()).build();%0A                floatingView.startFloating(builder);%0A%0A
             %7D%0A  

update demo