Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set content view in Reachability #6

Open
athirasanthosh opened this issue Oct 3, 2015 · 3 comments
Open

set content view in Reachability #6

athirasanthosh opened this issue Oct 3, 2015 · 3 comments

Comments

@athirasanthosh
Copy link

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

@sakebook
Copy link
Owner

sakebook commented Oct 3, 2015

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

@athirasanthosh
Copy link
Author

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

@sakebook
Copy link
Owner

sakebook commented Oct 3, 2015

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();
            }
        });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants