自定义视图焦点区域

时间:2018-09-06 07:42:38

标签: android

我有一个自定义视图,看起来像这样:

<LinearLayout
    android:orientation="vertical">
    <TextInputLayout>
        <TextInputEditText />
    </TextInputLayout>
    <TextView
        android:text="Some info text" />
</LinearLayout>

基本上是带提示的普通编辑文本,其下面带有“信息”文本。

当我尝试在自定义视图上requestFocus()时出现问题。它将光标正确地放置在编辑文本中,但仅滚动到编辑文本的底部。因此,“信息”文本将被“隐藏”,直到用户向下滚动一点。

是否可以告诉自定义视图其“焦点区域”是什么?也许是另一种使系统正确滚动的机制(即滚动到“信息”文本的底部?

任何帮助将不胜感激。谢谢。

1 个答案:

答案 0 :(得分:0)

调用此方法并传递EditText和ScrollView的变量,

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

from multiprocessing import Process

import cv2
#from scipy.stats import math
import datetime
count = 0
def saving_frame(frame):
    count = 0
    date_string = datetime.datetime.now().strftime("%Y-%m-%d-%H:%M")
    count = count +1 
    cv2.imwrite('Frame_'+str(count)+date_string+'.png',frame)
    return

def runInParallel(*fns):
      proc = []
      for fn in fns:
        p = Process(target=fn)
        p.start()
        proc.append(p)
      for p in proc:
        p.join()


video_capture_1 = cv2.VideoCapture(0)

video_capture_2 = cv2.VideoCapture(1)

video_capture_3 = cv2.VideoCapture(2)

print ('Start Rec')

while True:
    ret_1, frame_1 = video_capture_1.read()
    ret_2, frame_2 = video_capture_2.read()
    ret_3, frame_3 = video_capture_3.read()

    runInParallel(saving_frame(frame_1),saving_frame(frame_2),saving_frame(frame_3))

    cv2.imshow('frame1', frame_1)
    cv2.imshow('frame2', frame_2)
    cv2.imshow('frame3', frame_3)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
video_capture_1.release()
video_capture_2.release()
video_capture_3.release()

cv2.destroyAllWindows()

完成