首页 > 解决方案 > 使用叠加层时如何使按钮可点击

问题描述

我希望覆盖下的设置按钮能够只单击一个按钮。我尝试setClickable覆盖布局。如果不在覆盖布局中,则按钮无法单击,但如果我想单击按钮,我只想按按钮。问题:我想知道我可以通过哪种方式制作用户将按教程使用该应用程序的教程

打开就是APP

在此处输入图像描述

当按教程

在此处输入图像描述

我希望按钮可以在出现工具提示时单击

在此处输入图像描述

我设置按下按钮是

public void onClick(View v) {
if (v.getId() == R.id.button8) {
           .
           .
            //This is Set Constraintlayout id in isoverlay
            overlay.setVisibility(View.VISIBLE);
            overlay.setClickable(true);
     }
if (v.getId() == R.id.bisoverlay) {

if (c == 0) {
      t1 = new Tooltip.Builder(b1)
         .setText("FragButton")
         .setGravity(Gravity.BOTTOM)
         .show();
         c++;
          }
   .
   .
   .
     }

}

我希望当工具提示出现在 Button 上时,Button 可以通过覆盖单击不是GONE 此 XML 代码:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout ...>

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <android.support.constraint.ConstraintLayout
            android:id="@+id/moverlay"
            android:layout_width="match_parent"
            android:layout_height="match_parent">
            <!--android:clickable="true"-->

            <fragment
                android:id="@+id/fragment1"
                android:name="com.example.test.BlankFragment"
                .../>

            <Button
                android:id="@+id/button8"
                ... />

            <Button
                android:id="@+id/button9"
                ... />

        </android.support.constraint.ConstraintLayout>

        <android.support.constraint.ConstraintLayout
            android:id="@+id/isOverlay"
            ...

            <Button
               ...
        </android.support.constraint.ConstraintLayout>

    </FrameLayout>

</android.support.constraint.ConstraintLayout>

我在 mainActivity 中的事件上使用片段按钮

id应该怎么做?(对不起英语)

标签: javaandroid

解决方案


好的,我现在使用FancyShowCaseview库。它的工作!覆盖教程用户指南,第一次,我不想使用库,因为想练习我的 android 但我不知道。谢谢你,对不起英语(我会练习的。)


推荐阅读