안드로이드 개발 질문/답변
(글 수 45,052)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="test" />
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<View
android:layout_width="800px"
android:layout_height="match_parent"
android:background="@android:color/transparent"/>
<View
android:layout_width="800px"
android:layout_height="match_parent"
android:background="@android:color/black"/>
</LinearLayout>
</HorizontalScrollView>
</FrameLayout>
FrameLayout에 Button과 HorizotalScrollView를 넣었는데요 ..
보시는 바와 같이 투명한 뷰 부분에서 버튼을 클릭하고 싶은데
android:focusable="true"
android:focusableInTouchMode="true"를 줘도 도무지 되질 않네요 .. ㅠㅠ
구글링을 하여도 답답한 마음은 풀리질 않습니다. 비슷한 경험을 하셨던 분 계신가요 .. ?
framelayout 특성 상 겹쳐지게 되어있고 일반적으로는 마지막에 올라온 뷰가 최상위 레이어에 위치합니다.
즉 horizontal 뷰가 focus를 빼앗아 가기때문에 button까지 포커스가 안가는건 지극히 당연한 결과입니다.
레이아웃 구조를 변경해야 할 듯 싶네요.
그게아니라면 horizontal뷰가 아래로 내려가거나 포커스를 못갖게 되면 해결 될겁니다.