群友的问题
研究了一下, 演示如下
autojs版本: 4.1.1 Alpha
importClass(android.widget.RelativeLayout); console.show(); toastLog(app.versionName); let mConsoleView = getConsoleWindow(); let parent = mConsoleView.parent; var inputView = parent.findViewById(context.getResources().getIdentifier("input", "id", context.getPackageName())); var buttonView = parent.findViewById(context.getResources().getIdentifier("submit", "id", context.getPackageName())); var consoleView = parent.findViewById(context.getResources().getIdentifier("console", "id", context.getPackageName())); console.setSize(1000, 1000); ui.run(function () { inputView.setVisibility(8); buttonView.setVisibility(8); }); let r = filterView(mConsoleView); r[3].setText("牙叔教程 简单易学"); ui.run(function () { r[0].attr("bg", "#ffff00"); let view = ui.inflate( <text textSize="30sp" textColor="#00ff00" bg="#ff00ff" gravity="center"> 牙叔教程 简单易懂 </text>, null, false ); let view2 = ui.inflate( <text textSize="30sp" textColor="#00ff00" bg="#ff00ff" gravity="center" layout_alignParentBottom="true"> 牙叔教程222 简单易懂 </text>, null, false ); ui.post(function () { view.attr("w", "match_parent"); view2.attr("w", "match_parent"); }); r[0].addView(view); let rlp1 = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT ); rlp1.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE); r[0].addView(view2, rlp1); }); setInterval(function () {}, 1000); /* -------------------------------------------------------------------------- */ function getConsoleWindow() { var field = runtime.console.class.getDeclaredField("mConsoleFloaty"); field.setAccessible(true); mConsoleView = field.get(runtime.console).getExpandedView(); return mConsoleView; } function filterView(view, arr) { arr = arr || []; if (view instanceof android.view.ViewGroup) { arr.push(view); let childCount = view.childCount; for (var i = 0; i < childCount; i++) { let chileView = view.getChildAt(i); filterView(chileView, arr); } } else { arr.push(view); } return arr; }
参考
名人名言
思路是最重要的, 其他的百度, bing, stackoverflow, 安卓文档, autojs文档, 最后才是群里问问
--- 牙叔教程
声明
部分内容来自网络
本教程仅用于学习, 禁止用于其他用途