Reachability icon indicating copy to clipboard operation
Reachability copied to clipboard

set content view in Reachability

Open athirasanthosh opened this issue 9 years ago • 3 comments

is it possible to set layout inside the Reachability. Meansi need to set layout instead of "R.drawable.tiles".is it possible?

athirasanthosh avatar Oct 03 '15 05:10 athirasanthosh

Reachability can have ImageView. You can set ImageView layout and resource to Reachability. You can use the setHoverView To set the ImageView.

// Create ImageView to use for Reachability
ImageView view = new ImageView(this);
view.setBackgroundResource(R.drawable.custom_button_selector); // for change state
view.setScaleType(ImageView.ScaleType.CENTER);

Reachability reachability = new Reachability(this);
reachability.setHoverView(view, R.drawable.back_pull, R.drawable.back_push); // for change image 
reachability.makeHoverView(Reachability.Position.CENTER);

Sample code. This has been used in the demo apk. https://github.com/sakebook/Reachability/blob/master/demo/src/main/java/com/sakebook/android/sample/reachabilitysample/CustomAnimationActivity.java

sakebook avatar Oct 03 '15 11:10 sakebook

is it possible to add activity_my.xml as reachability HoverView?

athirasanthosh avatar Oct 03 '15 11:10 athirasanthosh

No, HoverView attached RootView. Can not support xml as HoverView.

But you can call switchBack. switchBack as same as HoverView click. You can use the Reachability anywhere.

        findViewById(R.id.some_button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mReachability.switchBack();
            }
        });

sakebook avatar Oct 03 '15 16:10 sakebook