Giter Club home page Giter Club logo

Comments (6)

YoshihideSogawa avatar YoshihideSogawa commented on September 12, 2024 1

FloatingView executes a click event only for the top level view.
Therefore, please bridge the click event from MapViewRelativeView to Button.

public class MapRelativeLayout extends RelativeLayout{
    LayoutInflater mInflater;
    public MapRelativeLayout(Context context) {
        super(context);
        mInflater = LayoutInflater.from(context);
        init();
    }

    public void init() {
        View v = mInflater.inflate(R.layout.widget_map_relative_layout, this, true);
        final Button btn = (Button) findViewById(R.id.button);
        btn.setText("Testing");
        btn.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.d("TEST", "Testing");
            }
        });

        // Added:MapRelativeLayout's click
        setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // call button event
                btn.performClick();
            }
        });
    }
}

from floatingview.

YoshihideSogawa avatar YoshihideSogawa commented on September 12, 2024 1

Sample code please

from floatingview.

tommyim avatar tommyim commented on September 12, 2024

Thanks YoshihideSogawa, that's work, but if I need to add more button in RelativeLayout, that does not work.

from floatingview.

tommyim avatar tommyim commented on September 12, 2024

MapRelativeLayout class

public class MapRelativeLayout extends RelativeLayout {
    LayoutInflater mInflater;
    Button btnA;
    Button btnB;
    public MapRelativeLayout(Context context){
        super(context);
        mInflater = LayoutInflater.from(context);
        init();
    }

    public void init()
    {
        View v = mInflater.inflate(R.layout.widget_map_relative_layout, this, true);
        
        btnA = v.findViewById(R.id.buttonA);
        btnA.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.d("Testing", "buttonA");
            }
        });

        btnB = v.findViewById(R.id.buttonB);
        btnB.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                Log.d("Testing", "buttonB");
            }
        });
    }
}

from floatingview.

YoshihideSogawa avatar YoshihideSogawa commented on September 12, 2024

FloatingView only supports clicking of one View.
If you have an idea to modify please give me a Pull Request.

from floatingview.

YoshihideSogawa avatar YoshihideSogawa commented on September 12, 2024

#12

from floatingview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.