有没有办法确保导航抽屉停留在片段中的内容之上?
我用虚拟数据创建了一个小测试应用程序.10个片段,带有相应的编号按钮和textview.问题在于片段元素似乎比导航抽屉具有更高的优先级.
如截图所示,一旦我尝试打开"0片段",它就会选择在导航抽屉后面的按钮上注册点击.按任何其他内容项工作正常,但只要它们下面没有其他可交互项目.如何让导航抽屉正确地保留在其背后的内容之上,我该怎么办?
如何制作iframe点击,但是iframe的正文仍然可以点击?
我试过了:
iframe.style.width = '100%'
iframe.style.height = '100%'
iframe.style.display = 'block'
iframe.style.position = 'fixed'
iframe.style.backgroundColor = 'transparent'
iframe.style.pointerEvents = 'none'
iframe.style.border = '0'
iframe.frameborder = '0'
iframe.scrolling = 'no'
iframe.allowTransparency = 'true'
Run Code Online (Sandbox Code Playgroud)
在我的框架内我使用以下css:
html, body {
/* background:none transparent; */
pointer-events:auto;
}
Run Code Online (Sandbox Code Playgroud)
这会导致身体可见(这就是我想要的),但它像iframe的其余部分一样是点击式的.我希望iframe的主体可以点击,但实际的iframe元素的其余部分应该是点击式的.
iframe总是比它里面的身体大.
不幸的是我无法从主站点访问iframe内容(因此无法访问scrollHeight等),我只能更改其实际的源代码.
正常的OSX应用程序在没有聚焦时首先点击鼠标点击应用程序.然后,应用程序将处理未来的点击次数.iTunes播放/暂停按钮和Finder的行为有所不同,即使没有聚焦,第一次点击也会被激活.我正在寻找一种方法来强制现有的应用程序(远程桌面连接.app)在第一次单击时起作用,而不仅仅是焦点.
我想在Java中创建一个透明的覆盖层,总是在顶部,并且我可以点击.我发现了一些关于这个问题的类似 帖子,但即使按照他们的答案,我也有一个问题.
我的问题是让整个窗口点击.我并没有使其与一个JFrame工作的任何问题,但一旦我添加任何成分给它(的JLabel或ImagePanel)中,点击通过属性不结转给他们.
因为我想为我的应用程序提供一个背景图像,这基本上使我无法看到当我单击文本/图像所覆盖的区域时窗口如何聚焦的代码.
在我展示我正在使用的代码之前,我首先想要参考这些 线程,这些线程基本上准确地描述了我想要的东西,除了在C#中.
我的目标是创建一个带有透明.png图像和一些顶部文本的叠加层,这些叠加层会在关键事件上发生变化.如果它使用JFrame或任何其他库无关紧要.我只需要它与Windows兼容.
我还想提一下,我有一些Java经验,但是使用JFrame是一个新手.
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import com.sun.jna.platform.WindowUtils;
public class Overlay {
public static void main(String[] args) {
JFrame frame = new JFrame("Overlay Window");
frame.setUndecorated(true);
frame.setAlwaysOnTop(true);
frame.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", false);
frame.setLocation(400, 400);
frame.getContentPane().setLayout(new java.awt.BorderLayout());
JLabel textLabel = new JLabel("I'm a label in the window", SwingConstants.CENTER);
frame.getContentPane().add(textLabel, BorderLayout.CENTER);
frame.pack();
System.setProperty("sun.java2d.noddraw", "true");
WindowUtils.setWindowTransparent(frame, true);
WindowUtils.setWindowAlpha(frame, …
Run Code Online (Sandbox Code Playgroud) 我找不到让这项工作的方法.
我的应用程序有2个FrameLayouts和许多子视图(为简单起见假设ImageViews),一个堆叠在另一个上面.
我的问题是,我需要在TOP和所有它的孩子上使用FrameLayout来让触摸通过它们,到达底层的FrameLayout(及其子节点).像指针事件:HTML中没有应用于TOP framelayout的所有图像视图.
我已经在FrameLayout及其子节点上尝试了setClickable(false)和setEnabled(false),但是如果我单击一个禁用的子节点(例如ImageView),触摸将无法到达底层的ImageView(即底层的子节点)的FrameLayout)
以下代码是我最好的尝试禁用FrameLayout及其子代(mSlideLayout是父FrameLayout,图层是每个imageview子代).我错过了什么?
/** Create the layers structure into the layout */
void create_layers() {
Context context=getActivity();
mSlideLayout.removeAllViews();
for (FunqLayer layer:mLayers) {
if (layer!=null) {
View v=layer.init_internal(context, mSlideLayout); // constructs the child layer, suppose it's an ImageView
if ((v!=null) && (mIsMuteTouches)) {
v.setEnabled(false);
v.setClickable(false);
// this should obviously let touches pass through but it doesnt :(
}
}
}
if (mIsMuteTouches) {
// also do the same in the FrameLayout itself with no luck :(
mSlideLayout.setEnabled(false);
mSlideLayout.setClickable(false); …
Run Code Online (Sandbox Code Playgroud) 为了给出一些背景知识,我正在开发一款软件,可以帮助玩家玩星球大战:旧共和国.游戏的用户界面功能非常有限,所以我正在开发一个外部应用程序,它将实时解析日志,并输出视觉线索,以帮助用户最大化他们的游戏性能.例如,如果角色获得某个"buff",战斗日志将显示它,我想在屏幕上放置一个视觉线索(因此用户不需要注意周边的小图标)屏幕).
在开始之前,我想为自己创建一些"概念证明"脚本,以弄清楚我将如何处理主要部分.我坚持的是我有问题的地方:
我需要能够在游戏的屏幕上显示一个图形,可能是一个透明的PNG文件.用户需要能够点击该图像,以便他们可以继续与游戏进行交互.我对如何去做有点迷茫.要求是:
任何关于从哪里开始的指导将非常感谢!
当我在我创建的Android应用程序中打开导航抽屉时,我仍然可以单击主要布局中的列表项(内容布局).我的意思是,我实际上能够通过我的导航抽屉点击一个ListView
项目.我的导航抽屉里还没有任何可点击的项目,但我把它放在一个白色背景的正确的.抽屉的内容,我正在设计一个片段.这是我的代码:FrameLayout
activity_home.xml(MainActivity)
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
tools:context=".HomeActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<include
android:id="@+id/toolbar_home"
layout="@layout/my_awesome_toolbar" />
<FrameLayout
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageButton
android:id="@+id/fab_addContact"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_marginBottom="@dimen/view_margin_large"
android:layout_marginEnd="@dimen/view_margin_large"
android:layout_marginRight="@dimen/view_margin_large"
android:background="@drawable/fab_button"
android:contentDescription="@string/fab_contDesc"
android:padding="@dimen/view_margin_large"
android:src="@drawable/ic_add_white_24dp" />
</FrameLayout>
</LinearLayout>
<FrameLayout
android:id="@+id/drawer_frame"
android:layout_width="300dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@android:color/white"
android:clickable="true" />
</android.support.v4.widget.DrawerLayout>
Run Code Online (Sandbox Code Playgroud)
fragment_drawer.xml(DrawerFragment进入@+id/drawer_frame
)
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/white"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="144dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:src="@drawable/material_design_wallpaper" />
<ImageView
android:id="@+id/iv_userThumbnail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" …
Run Code Online (Sandbox Code Playgroud) android click-through android-appcompat android-listview navigation-drawer
我想要类似这样的屏幕录制软件。
<Window x:Class="WpfTestApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfTestApp"
mc:Ignorable="d"
ShowInTaskbar="False" WindowStyle="None" ResizeMode="NoResize"
AllowsTransparency="True"
UseLayoutRounding="True"
Opacity="1"
Cursor="ScrollAll"
Topmost="True"
WindowState="Maximized"
>
<Window.Background>
<SolidColorBrush Color="#01ffffff" Opacity="0" />
</Window.Background>
<Grid>
<Canvas x:Name="canvas1">
<Path Fill="#CC000000" Cursor="Cross" x:Name="backgroundPath">
<Path.Data>
<CombinedGeometry GeometryCombineMode="Exclude">
<CombinedGeometry.Geometry1>
<RectangleGeometry Rect="0,0,1440,810"/>
</CombinedGeometry.Geometry1>
<CombinedGeometry.Geometry2>
<RectangleGeometry Rect="300,200,800,300" />
</CombinedGeometry.Geometry2>
</CombinedGeometry>
</Path.Data>
</Path>
</Canvas>
</Grid>
Run Code Online (Sandbox Code Playgroud)
现在的问题是我无法使半透明区域backgroundPath
单击。我将其IsHitTestVisible
属性设置为false,但仍然没有更改。我曾经SetWindowLong
使整个窗口透明,这使我可以单击窗口,但是那样我的窗口及其中的所有控件均无法正常工作。
有人可以建议我如何实现这一目标吗?
该函数是从Tying 复制来使用 TkInter 设置不可交互(点击)覆盖
不仅窗口无法点击,PNG 也不透明。PNG在这里: https: //drive.google.com/file/d/1tlLl2hjPq38mc_c_PpMhkKDlP1HqvDY5/view
窗口如下所示:
我缺少什么?
from tkinter import*
import win32gui
from win32gui import GetForegroundWindow, ShowWindow, FindWindow, SetWindowLong, GetWindowLong, SetLayeredWindowAttributes
from win32con import SW_MINIMIZE, WS_EX_LAYERED, WS_EX_TRANSPARENT, GWL_EXSTYLE
def setClickthrough(hwnd):
try:
styles = GetWindowLong(hwnd, GWL_EXSTYLE)
styles |= WS_EX_LAYERED | WS_EX_TRANSPARENT
SetWindowLong(hwnd, GWL_EXSTYLE, styles)
SetLayeredWindowAttributes(hwnd, 0, 255, win32con.LWA_ALPHA)
except Exception as e:
print(e)
root = Tk()
root.geometry("100x100")
root.overrideredirect(1)
root.attributes('-topmost', 1)
pic = PhotoImage(file=r'on2.png')
root.wm_attributes("-transparentcolor", 'white')
boardbutton = Label(root, image=pic, bd=0,
bg='white')
boardbutton.pack()
setClickthrough(root.winfo_id())
root.mainloop()
Run Code Online (Sandbox Code Playgroud) 我有一个jquery幻灯片,它使用导航列表来切换幻灯片图像.它的工作原理是当您将鼠标悬停在导航列表上时,它突出显示('.active')并且关联的图像会切换到该列表.导航列表中有链接,也可以单击这些链接转到其他页面.
我需要这个在平板电脑上工作,这样当人们点击导航列表时,它会变为活动状态,然后图像幻灯片切换,然后如果再次点击它会跟随到该链接.现在发生的事情是,只要点击它,它就会变为活动状态并点击进入.
这是jquery
$(".main_image .desc").show(); //Show Banner
$(".main_image .block").animate({ opacity: 0.8 }, 1 ); //Set Opacity
//Click and Hover events for thumbnail list
$(".image_thumb ul li:first").addClass('active');
$(".image_thumb ul li").hover(function(e){
//Set Variables
e.preventDefault();
var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
var imgTitle = $(this).find('a.imgloc').attr("href"); //Get Main Image URL
var imgDesc = $(this).find('.block').html(); //Get HTML of block
var imgDescHeight = $(".main_image").find('.block').height(); //Calculate height of block
if ($(this).is(".active")) { //If it's already active, then...
return false; // Don't click through
} …
Run Code Online (Sandbox Code Playgroud)