In general, I try to make part of the screen of my application "scrolled", there are buttons on each page. OnCreate () MainActivity
LayoutInflater inflater = this.getLayoutInflater(); View main_buttons_layout_view = inflater.inflate(R.layout.main_buttons_layout, flipper, false); View side_buttons_layout_view = inflater.inflate(R.layout.side_buttons_layout, flipper, false); Button leftMouseButton = (Button) main_buttons_layout_view.findViewById(R.id.LeftMouseButtonMainButtonsLayout); Button rightMouseButton = (Button) main_buttons_layout_view.findViewById(R.id.RightMouseButtonTouchpad); ViewFlipper flipper = (ViewFlipper) findViewById(R.id.flipper); //Первая и вторая странички с кнопками int layouts[] = new int[]{R.layout.main_buttons_layout, R.layout.side_buttons_layout}; for (int layout : layouts) flipper.addView(inflater.inflate(layout, null)); //Обработчики leftMouseButton.setOnTouchListener(leftMouseButtonTouchListener); rightMouseButton.setOnTouchListener(rightMouseButtonTouchListener); In MainActivity.xml there is
<ViewFlipper android:id="@+id/flipper" android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="20"/> Accordingly, the left mouse button and the right mouse button buttons are defined in main_buttons_layout.xml . But the problem is that pressing the buttons does not work. Debazh, the code does not even go into the handlers, similarly for the buttons of the second hml - side_buttons_layout.xml. What could be the problem?