我是Android新手。我正在开发一种app锁柜。当用户启动一个锁定的应用时,我想始终在全屏'//Procedure name.
Sub Seperate_Item_Codes_and_Descriptions()
'//A comment.
'Seperate the item codes and the descriptions and put them in respectively in columns D and E.
'//Setting up the variables.
Dim s As Long, a As Long, aVALs As Variant
'//Everything between this statement and End With that starts with a '.' will apply to the
'//first worksheet in the workbook (if you rearrange the order of sheets it will still look
'//at the tab that appears first in the workbook).
With Worksheets(1)
'Get all values in the range B12 to last row containing data in column B and place in an array.
'Value2 is the same as Value except it doesn't use Currency or Date formats.
'https://support.microsoft.com/en-us/kb/182812
'The array will be: aVALS(1 to rownum,1 to 1)
'Use aVALS(1,1) for first value, aVALS(2,1) for second value.
'NB: If the last row is higher up than row 12 you'll get unexpected results.
aVALs = .Range(.Cells(12, "B"), .Cells(.Rows.Count, "B").End(xlUp)).Value2
'Update the last dimension of the array, while keeping the original values so its: aVALS(1 to rownum, 1 to 2)
'Use aVALS(1,1) is first value, aVALS(1,2) is empty, aVALS(2,1) is second value...
ReDim Preserve aVALs(LBound(aVALs, 1) To UBound(aVALs, 1), 1 To 2)
'Step through the first dimension of the array (the 1 to rownum bit).
For a = LBound(aVALs, 1) To UBound(aVALs, 1)
'Find the location of the first space in the element of the dimension being looked at.
'Chr(32) is an Ascii space... I think.
s = InStr(1, aVALs(a, 1), Chr(32))
'Split the array by space and repopulate the array.
'Will now read as aVALS(1,1) = text to left of space, aVALS(1,2) = text to right of space.
aVALs(a, 2) = Mid(aVALs(a, 1), s + 1)
aVALs(a, 1) = Left(aVALs(a, 1), s - 1)
Next a
'Paste the array of split text back into the first worksheet in column D & E.
.Cells(12, "D").Resize(UBound(aVALs, 1), UBound(aVALs, 2)) = aVALs
End With
End Sub
上开始监听Activity
。我想让用户摆脱onTouchEvent()
只有当他/她输入敲门密码作为密码时。我使用以下代码来锁定按钮,使Activity
始终位于顶部(来源:Creating a system overlay window (always on top))。但是Activity
没有收到针对爆破代码的任何触摸。
我经常搜索并尝试了很多代码。但总有一种解决方案会破坏当前问题等其他部分!
onTouchEvent()
答案 0 :(得分:0)
onTouchEvent()
不起作用,因为我们在所有内容上都有叠加层。因此,当我们触摸屏幕时,我们会触摸ViewGroup
。因此,当用户触摸onTouchEvent()
时,我们需要触发ViewGroup
。我们可以像这样触发它:
mTopView.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent event)
{
// do something ...
}
});