我有两个焦点问题:
如果我的EditText
被关注并且显示键盘;然后我按下硬件后退键,键盘
隐藏但我的EditText
仍然是焦点(它仍然显示一个闪烁的光标)。
当我按下工具栏中EditText
左侧的actionbartoggle时,键盘可见且EditText
被聚焦,键盘隐藏,EditText
失去焦点。这是正确的。但是当我按下Button
(EditText
的右侧)而键盘显示且EditText
有焦点时,除Button
侦听器外没有任何其他事情发生。
当我将focusableintouchmode=true
和focusable=true
属性放在Button
上时,键盘会隐藏,EditText
会失去焦点但听众不再工作
<android.support.v7.widget.Toolbar
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/toolbar"
style="@style/toolbarStyle"
android:layout_width="match_parent"
android:layout_height="@dimen/toolbarHeight" >
<RelativeLayout
android:id="@+id/focusHolder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusable="true"
android:focusableInTouchMode="true"
android:layout_centerVertical="true"
>
<ImageButton
android:id="@+id/refreshBtn"
android:src="@drawable/refreshicon"
android:layout_width="48dp"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:background="@null" />
<EditText
android:id="@+id/addressBar"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_toLeftOf="@id/refreshBtn"
android:singleLine="true"
android:imeOptions="actionGo"
android:layout_centerVertical="true"
android:drawableLeft="@drawable/searchicon"
android:drawablePadding="5dp"
style="@style/addressBarStyle"/>
</RelativeLayout>
</android.support.v7.widget.Toolbar>
答案 0 :(得分:0)
试试这段代码......
Public Sub Function3_FileExplorer()
Dim file As Variant
' Start File Explorer to select file containing data (simple GUI, much easier than coding vFileName)
With Application.FileDialog(msoFileDialogOpen)
.AllowMultiSelect = False
If .Show Then
file = .SelectedItems(1)
Path = file
End If
End With
MsgBox file
Exit Sub
ErrorHandler:
MsgBox "Error detected" & vbNewLine & "Error" & Err.Number & _
Err.Description, vbCritical, "Error Handler: Error " & Err.Number
End Sub