var mainWindowconfig = floaty.rawWindow(
<vertical padding="16" layout_height="match_parent">
<card layout_width="match_parent" cardBackgroundColor="#ffffff" cardCornerRadius="12" cardElevation="4" padding="20dp" margin="10dp">
<scroll layout_width="match_parent" layout_height="600dp" padding="5dp">
<vertical>
<text text="参数配置" textSize="20sp" textStyle="bold" padding="15dp" gravity="center" backgroundColor="#f5f5f5" borderRadiusTopLeft="10dp" borderRadiusTopRight="10dp" marginBottom="15dp"/>
<text text="运行模式" textSize="17sp" marginBottom="8dp"/>
<spinner id="select_runtype" layout_width="match_parent" layout_height="45dp" entries="单商品购买|循环购买" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true"/>
<text text="关键词" textSize="17sp" marginBottom="8dp"/>
<input id="text_word" hint="请输入群名称或好友名称的关键词" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" inputType="text" focusable="true" focusableInTouchMode="true"/>
<text text="商品名关键词" textSize="17sp" marginBottom="8dp"/>
<input id="prodect_text_word" hint="可选,输入商品名称关键词" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" inputType="text" focusable="true" focusableInTouchMode="true"/>
<text text="支付密码" textSize="17sp" marginBottom="8dp"/>
<input id="text_password" hint="不需要脚本输入密码填0" inputType="number" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true" focusableInTouchMode="true"/>
<text text="购买方式" textSize="17sp" marginBottom="8dp"/>
<spinner id="select_getshopfun" layout_width="match_parent" layout_height="45dp" entries="到店取|送到家|在线抽" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true"/>
<text text="规格选择" textSize="17sp" marginBottom="8dp"/>
<spinner id="select_type" layout_width="match_parent" layout_height="45dp" entries="单个盲盒随机发货|整盒含*个盲盒" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true"/>
<text text="数量" textSize="17sp" marginBottom="8dp"/>
<input id="text_number" hint="例如填2" inputType="number" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true" focusableInTouchMode="true"/>
<text text="最大刷新次数" textSize="17sp" marginBottom="8dp"/>
<input id="text_timeoutcount" hint="建议5000+" inputType="number" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true" focusableInTouchMode="true"/>
<text text="单次刷新延时" textSize="17sp" marginBottom="8dp"/>
<input id="text_refush_timeout" hint="单位为ms(1s=1000ms)" inputType="number" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true" focusableInTouchMode="true"/>
<text text="2刷总执行时长" textSize="17sp" marginBottom="8dp"/>
<input id="text_refush_timeout_tow" hint="单位为s,建议600-900" inputType="number" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true" focusableInTouchMode="true"/>
<text text="2刷模式" textSize="17sp" marginBottom="8dp"/>
<spinner id="select_runtype_refush_two" layout_width="match_parent" layout_height="45dp" entries="正常模式|无跳转模式|快速模式" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="15dp" focusable="true"/>
<text text="无跳转模式每次动作延时" textSize="17sp" marginBottom="8dp"/>
<input id="text_refush_timeout_tow_delay" hint="单位为ms,建议100-200" inputType="number" layout_width="match_parent" layout_height="45dp" marginTop="0dp" padding="10dp" backgroundColor="#f9f9f9" marginBottom="20dp" focusable="true" focusableInTouchMode="true"/>
<horizontal padding="16" marginTop="16" layout_width="match_parent" layout_height="150dp">
<button id="saveBtn" text="保存配置" layout_weight="1" backgroundColor="#4CAF50" textColor="#ffffff" textSize="16sp" padding="10dp" borderRadius="6dp"/>
<button id="runBtn" text="关闭配置" layout_weight="1" marginLeft="8dp" backgroundColor="#2196F3" textColor="#ffffff" textSize="16sp" padding="10dp" borderRadius="6dp"/>
</horizontal>
</vertical>
</scroll>
</card>
</vertical>
); 悬浮窗显示UI界面无法进行交互点击输入无输入法选择框无选择内容显示

已存档
七月CX · 27 天前

回答

Hamibot AI
1
· 27 天前

你的悬浮窗无法交互和输入可能由以下原因导致,以下是具体排查步骤和解决方案:

  1. 权限问题
    确保脚本已申请浮窗权限和输入法权限,需在脚本开头添加:

    auto.waitFor();
    
  2. 输入法触发问题
    需手动绑定输入法到输入框,修改代码如下:

    var input = mainWindowconfig.findViewByID("text_word");
    input.setOnFocusChangeListener(function(view, hasFocus) {
        if (hasFocus) {
            view.getInputMethod().show();
        }
    });
    
  3. 焦点属性设置
    检查XML中是否正确设置焦点属性(你已设置focusable="true"focusableInTouchMode="true"),但需确保父容器未阻止焦点传递。

  4. UI线程问题
    如果后续操作需修改UI,必须使用ui.run(),例如:

    ui.run(function() {
        mainWindowconfig.text_word.setText("测试");
    });
    
  5. 系统兼容性限制
    部分机型(如MIUI)需要额外授权,可尝试:

    floaty.setLayoutInScreen(true); // 强制全屏布局
    
  6. 调试建议
    添加日志检查控件是否初始化成功:

    log("输入框是否存在: " + (mainWindowconfig.findViewByID("text_word") != null));
    

如果问题仍存在,建议简化布局测试基础功能,逐步排查问题组件。

ℹ️ 本回答由 AI 生成,内容仅供参考