autofocus 相关问题

Android camera2 api触控焦点的例子?

嗨,我正在使用camera2basic示例来实现我的camera2应用程序。我找不到任何好的例子来实现触摸以使用camera2 api进行聚焦。目前我用于触控的代码是......

回答 1 投票 6

HTML:如何在html中每次单击选项卡时刷新页面/文档?

我准备了一个带有标签的html页面。每个选项卡都有输入字段。下面是html代码。 ...

回答 1 投票 0

Bootstrap Material Design(4.1.1)的bmd-label-floating与自动聚焦属性不兼容

1.页面加载自动聚焦属性不会触发Bootstrap-JavaScript将is-focused类添加到相应的(bmd-)表单组。 ...

回答 3 投票 0

禁用编辑文本自动聚焦

我有一个编辑文本: 我有一个编辑文本: <LinearLayout android:id="@+id/linearLayout7" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_weight="1" android:id="@+id/editText1" android:text="3"> <requestFocus></requestFocus> </EditText> <Button android:text="Button" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button2"></Button> </LinearLayout> 然后下面还有一些其他东西 我遇到的问题是,当应用程序启动时,焦点就在输入上,我不希望在应用程序启动时焦点就在输入上。 我尝试删除 <requestFocus></requestFocus> 事情,但它没有做任何事情。 在EditText的父布局中添加android:focusable="true"和android:focusableInTouchMode="true"元素,如下; <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearLayout7" android:layout_width="fill_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true"> 我想,应该对你有帮助。 另见; Android 开发者关于处理触摸和输入的官方指南 如果您想清除编辑文本上的默认焦点,请使用以下 2 个属性 android:focusable="false" android:focusableInTouchMode="true" 在父线性布局内。 例如: <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="false" android:focusableInTouchMode="true" android:orientation="vertical"> <EditText android:layout_width="match_parent" android:layout_height="wrap_content" android:hint="email id" android:inputType="textEmailAddress" android:maxLines="1" /> </LinearLayout> 如果您想在创建活动时隐藏键盘,请在清单文件活动标记中使用这些属性 例如: <activity android:configChanges="screenSize|orientation|keyboardHidden" android:screenOrientation="portrait" android:name=".activities.LoginActivity" android:windowSoftInputMode="stateHidden|adjustResize"/> 如果您想在单击按钮或发生某些事件时隐藏键盘,请使用以下代码 public void onClick(View v) { try { //InputMethodManager is used to hide the virtual keyboard from the user after finishing the user input InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); if (imm.isAcceptingText()) { imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0); } } catch (NullPointerException e) { Log.e("Exception", e.getMessage() + ">>"); } } } catch (NullPointerException e) { Log.e("Exception", e.getMessage() + ">>"); } 如果您想在离开活动后将焦点从编辑文本字段中移开 @Override protected void onResume() { super.onResume(); mEmail.clearFocus(); mPassword.clearFocus(); } 最后,如果您想在提交表单时清除编辑文本字段中的数据,请使用 @Override protected void onResume() { super.onResume(); mEmail.getText().clear(); mPassword.getText().clear(); } 无需更多工作...只需添加 android:windowSoftInputMode="stateAlwaysHidden" 到 Manifest.xml 文件的活动标签。 <LinearLayout android:focusable="true" android:focusableInTouchMode="true" android:layout_width="0px" android:layout_height="0px" /> <EditText android:text="" android:id="@+id/EditText01" android:layout_width="wrap_content" android:layout_height="wrap_content" android:hint="@string/hint"> </EditText> 无需其他编码,这是一个简单明了的解决方案。 您可以使用隐藏窗口软输入模式来隐藏键盘和android:focusable="false"和android:focusableInTouchMode="true" <activity android:name=".MainActivity" android:windowSoftInputMode="stateHidden" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 在 LinearLayout 中尝试此代码 <LinearLayout android:focusable="true" android:focusableInTouchMode="true" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <EditText android:hint="Search..." android:drawableRight="@drawable/ic_search" android:id="@+id/search_tab_hotbird_F" android:layout_width="match_parent" android:layout_height="wrap_content" /> <android.support.v7.widget.RecyclerView android:id="@+id/recyHotbird_F" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="4dp"> </android.support.v7.widget.RecyclerView> </LinearLayout> 它对我有用,希望也能帮助你。 要么: android:windowSoftInputMode="stateAlwaysHidden" 将此属性添加到要禁用自动对焦的特定活动下的 Manifest.xml 文件中。 缺点:它只会隐藏您的软键盘,光标仍然在那里。 其他: android:focusableInTouchMode="true" 将此属性添加到您的 UI xml 文件(在父布局下),以便它将隐藏焦点以及键盘。 <EditText android:id="@+id/input" android:layout_width="0dp" android:layout_height="48dp" android:focusable="false" android:focusableInTouchMode="false" /> detailInputView = (EditText) debugToolsView.findViewById(R.id.input); detailInputView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { detailInputView.setFocusable(true); detailInputView.setFocusableInTouchMode(true); return false; } }); 只需将以下内容添加到主布局视图 xml 标签中: android:focusableInTouchMode="true" 嘿李, 有几种方法可以做到这一点,Mudassir已经为您提供了一种方法。 如果这个想法行不通,那就做简单的事- 在您的AndroidManifest>Activity中添加以下简单代码: android:windowSoftInputMode="stateHidden" XML 中的 EditText 无需执行任何操作,一切都会正常工作,并且不会出现焦点。 查看现实生活中的示例代码: <activity android:name=".MainActivity" android:windowSoftInputMode="stateHidden" android:label="@string/app_name" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> 为了获得清晰的默认 requestFocuse,您应该像下面这样设置 View 的父 focusable="true" <android.support.constraint.ConstraintLayout android:id="@+id/coordinatorChild" android:layout_width="match_parent" android:layout_height="wrap_content" android:focusable="true" android:focusableInTouchMode="true"> 在使父视图可见之前,我会执行此操作(并且工作正常),只要我触摸编辑文本,它就不会自动聚焦。 (parentView包含编辑文本) ... parentView.setFocusable(true); parentView.setFocusableInTouchMode(true); objProperties.setVisibility(VISIBLE); ... 我知道我迟到了大约 133 个月,但对于那些想知道的人来说,这对我有用: 布局膨胀时停止焦点 创建一个很小的随机对象(我选择了一个文本视图),并将 XML 属性 android:focusable="true" 和 android:focusableInTouchMode="true" 添加到您的代码中: <TextView android:id="@+id/focus_diversion" android:layout_width="1px" android:layout_height="1px" android:focusable="true" android:focusableInTouchMode="true" /> 以编程方式取消焦点 创建一个具有与上面相同属性的对象: <TextView android:id="@+id/focus_diversion" android:layout_width="1px" android:layout_height="1px" android:focusable="true" android:focusableInTouchMode="true" /> 并且在 Java 中,每当您想要取消其他视图的焦点时添加请求焦点: TextView decoy_focus = findViewById(R.id.focus_diversion); decoy_focus.requestFocus();

回答 13 投票 0

为什么autoFocusRangeRestriction没有效果?

你可以通过这样做来告诉iPhone相机专注于近处或远处的物体:试试! device.lockForConfiguration()defer {device.lockForConfiguration()} device.autoFocus Range Restriction = .near但是......

回答 1 投票 3

Camera Autofous不适用于子活动,而是来自已启动的活动

标题有点模糊,但问题解释起来有点棘手,所以这里......(在这种情况下,由于我没有完全用白话,我用“儿童活动”这个词来表示一个。 ..

回答 1 投票 0

将v-focus应用于页面上的第一个输入字段

我有一个Vue组件,我正在尝试使用v-focus自动聚焦第一个字段。但我的问题是,我的动态组件将包含在页面顶部。那么在那种情况下我怎么能......

回答 1 投票 0

TextInput autoFocus上没有显示键盘[本机反应]

我的应用程序中有这个回复按钮,当用户按下它时,它会将TextInput autoFocus更改为true。我将autoFocus值设置为false作为默认值并将其保持在某个状态。我看到......

回答 1 投票 0

有没有办法用ARCore相机设置自动对焦?

我正在开发一个应用程序,我需要使用ARCore放置对象。然后我需要将帧保存为图像。那么有没有办法为ARCore相机设置自动对焦?

回答 4 投票 6

无法突出显示下拉焦点

我试图在页面加载时突出显示选择标记的下拉列表。我在select标签中有多个类我尝试将焦点应用于所有这些类但它不起作用。任何人都可以请...

回答 1 投票 0

将参数添加到数组:自动对焦到Woocommerce登录字段

Heyo!目前在woocommerce登录页面上,Billing(名字)的第一个输入表单具有autofocus =“autofocus”,这意味着每次加载时页面都会跳转到该点。结算部分,...

回答 1 投票 0

HTML5 AutoFocus属性导致Firefox滚动到页面底部

我们有一个带有Twitter Bootstrap的HTML5应用程序()和各种其他JavaScript库(包括jQuery) - 所有这些都运行在他们当前的版本上。该页面包含一个文字......

回答 2 投票 9

angularjs autofocus在mozilla firefox中不起作用

请参阅jsfiddle链接http://jsfiddle.net/ounsqcmt/55/我曾经使用过自动对焦使用angularjs它在谷歌工作但不能在mozilla firefox中工作代码如下

回答 1 投票 0

Camera2正在捕获图像,然后锁定自动对焦并闪光

这是我访问camera2的片段:我已经实现了Google Camera2 Api示例(原样):但是相机正在捕获图像并且焦点稍后被锁定,并且......

回答 1 投票 1

HTML 5自动对焦会混乱CSS加载

当我在输入元素上设置autofocus =“autofocus”时,在Firefox中,当页面加载时,它会在没有应用CSS的情况下显示一瞬间。 (例如,内容不在中心,标题呈现在......

回答 1 投票 12

Sencha Touch自动对焦在文本字段上

我无法在sencha touch文本字段上进行自动对焦。我有搜索图标,当我点击该图标时会出现一个文本字段现在一旦显示我必须自动对焦到该文本字段并...

回答 1 投票 0

© www.soinside.com 2019 - 2024. All rights reserved.