마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

[재재업] 프로그램이 시작할때, 아래쪽으로 이동해서 위쪽에 포커스를 주고 싶습니다..

0 추천

안녕하세요.

현재 제가 어떤 xml 화면을 만들었는데.. 프로그램이 시작할 경우에 맨 아래쪽으로 포커스가 이동을 하는 바람에

어떻게 해야, 정상적으로 위에서 부터 아래로 스크롤을 내리면서 정상적인 화면이 될지 잘 모르겠습니다.

생각한 방법이, 프로그램이 시작할때 위쪽에 포커스를 주는 방법을 생각을 했었는데, 포커스를 주는 방법을

검색해보아도 쉽게 제가 해결을 할 수가 없어서 ㅠ 어떻게 만들어 주어야 할지 참 고민입니다.

 

별거 없는 xml 소스가 좀 긴 탓에, 원글에 글을 올렸을때 소스가 자꾸만 짤려서 답변 부분에 이어서 붙여보겠

습니다.. 어디가 잘못되어서 아래쪽에 으로 화면이 가지는지 도저히 모르겠네요 ㅠ

하나 미심쩍은 것은, 아래쪽에 보면 비디오뷰 관련해서 제거하게 된다면, 정상적으로 프로그램이 위쪽에서부터

정상적으로 가지는데, 비디오뷰를 넣는 순간 아래로 쏠리는 현상이 생깁니다.

이에 대한 답으로는 아래와 같은 답변을 들어보았습니다.

"VideoView 자체에 requestFocus() 가 있어서 자동으로 포커스가 움직여 집니다. 포커스에따라 scroll이 자동으로 움직여지는거라..." 이 말을 들었는데도 문제를 해결하는데 있어서 어떻게 헤쳐나가야할지 ㅠ 잘 모르겠습니다.

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_first__movie"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#ffffff"
    android:orientation="vertical">


    <RelativeLayout
        android:id="@+id/First_CustomAdapterMovie_Toolbar"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        >

        <ImageView
            android:id="@+id/Top_Image_button"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/loginactivity_image"/>

        <ImageView
            android:id="@+id/Before_Activity"
            android:layout_width="wrap_content"
            android:layout_toRightOf="@+id/Top_Image_button"
            android:layout_height="wrap_content" />

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/Top_Movie_Information"
            android:layout_marginTop="15dp"
            android:layout_centerHorizontal="true" />

    </RelativeLayout>

    

 

공산당 (1,960 포인트) 님이 2016년 11월 17일 질문
<LinearLayout
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:background="#000000"
        android:layout_marginTop="3dp"
        android:layout_marginBottom="3dp"
        ></LinearLayout>


    <ScrollView
        android:id="@+id/scrollview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <RelativeLayout
                android:id="@+id/Middle_Space"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginTop="10dp"
                android:background="#ffffff">

                <RelativeLayout
                    android:id="@+id/first_Relative"
                    android:layout_width="match_parent"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_height="wrap_content"/>

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/Reservation_Percent"
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp"
                        android:layout_alignParentTop="true" />

                    <TextView
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:id="@+id/hello"
                        android:paddingTop="10dp"
                        android:paddingBottom="10dp"
                        android:layout_centerVertical="true"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentEnd="true"
                        />

                    <ImageView
                        android:id="@+id/bell_image"
                        android:background="@drawable/bell"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_centerVertical="true"
                        android:clickable="true"
                        android:layout_toLeftOf="@+id/hello"
                        android:layout_toStartOf="@+id/hello" />

                </RelativeLayout>

                <RelativeLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:id="@+id/Second_Relative"
                    android:background="#ffffff"
                    android:layout_marginBottom="10dp"
                    android:layout_below="@+id/first_Relative"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true">

                    <ImageView
                        android:id="@+id/age_icon"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                         />

                    <TextView
                        android:id="@+id/Movie_name"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_centerVertical="true"
                        android:layout_toRightOf="@+id/age_icon" />


                </RelativeLayout>
<RelativeLayout
                    android:id="@+id/Third_Relative"
                    android:layout_width="match_parent"
                    android:layout_height="180dp"
                    android:background="#ffffff"
                    android:layout_marginLeft="10dp"
                    android:layout_below="@+id/Second_Relative"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true">

                    <RatingBar
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:numStars="5"
                        android:id="@+id/ratingBar"
                        android:layout_marginTop="15dp"
                        android:layout_marginLeft="10dp"
                        android:layout_alignParentTop="true"
                        android:layout_toRightOf="@+id/imageView"
                        style="@style/Widget.AppCompat.RatingBar.Small" />

                    <TextView
                        android:id="@+id/ratingBar_Rate_TextView"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@id/ratingBar"
                        android:layout_marginTop="12dp"
                        android:layout_marginRight="2dp"
                        android:layout_marginLeft="3dp"
                        />

                    <TextView
                        android:id="@+id/Participation_Rate"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_toRightOf="@+id/ratingBar_Rate_TextView"
                        android:layout_marginTop="12dp"
                        android:layout_marginLeft="3dp"
                        />


                    <TextView
                        android:id="@+id/Movie_Information_1"
                        android:layout_width="match_parent"
                        android:layout_height="wrap_content"
                        android:layout_marginTop="10dp"
                        android:layout_marginLeft="10dp"
                        android:layout_toRightOf="@id/imageView"
                        android:layout_below="@id/ratingBar"
                        />

                    <LinearLayout
                        android:id="@+id/Side"
                        android:orientation="horizontal"
                        android:layout_below="@+id/Movie_Information_1"
                        android:layout_width="match_parent"
                        android:layout_height="2dp"
                        android:background="#000000"
                        android:layout_toRightOf="@id/imageView"
                        android:layout_marginTop="5dp"
                        android:layout_marginBottom="5dp">

                    </LinearLayout>

                    <TextView
                        android:id="@+id/Movie_Information_2"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_below="@id/Side"
                        android:layout_marginTop="10dp"
                        android:layout_marginLeft="10dp"
                        android:layout_toRightOf="@id/imageView"
                        />

                    <ImageView
                        android:id="@+id/imageView"
                        android:layout_width="120dp"
                        android:layout_height="match_parent"
                        android:layout_alignParentTop="true"
                        android:layout_alignParentBottom="true" />

                    <ImageView
                        android:id="@+id/Dial_Image"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_toRightOf="@+id/Movie_Information_2"
                        android:layout_below="@+id/Side"
                        android:layout_marginRight="5dp"
                        android:layout_marginTop="13dp"
                        android:layout_centerHorizontal="true" />

                </RelativeLayout>
<RelativeLayout
                    android:id="@+id/fourth_Relative"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:background="#ffffff"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:layout_below="@+id/Third_Relative">

                    <Button
                        android:id="@+id/Direct_btn"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_marginRight="5dp"
                        android:layout_centerVertical="true"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentEnd="true" />

                </RelativeLayout>

                <LinearLayout
                    android:id="@+id/Rating_Top_LinearLayout"
                    android:orientation="horizontal"
                    android:layout_below="@id/fourth_Relative"
                    android:layout_above="@+id/Fifth_Relative"
                    android:layout_width="match_parent"
                    android:layout_height="3dp"
                    android:paddingBottom="5dp"
                    android:background="#0d00ff"
                    android:layout_centerHorizontal="true">
                </LinearLayout>

                <RelativeLayout
                    android:id="@+id/Fifth_Relative"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_marginTop="10dp"
                    android:layout_marginBottom="10dp"
                    android:background="#ffffff"
                    android:layout_below="@+id/fourth_Relative">

                    <RatingBar
                        android:id="@+id/Fifth_RatingBar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        android:numStars="5"
                        />

                    <TextView
                        android:id="@+id/RationgBar_TextView"
                        android:layout_below="@+id/Fifth_RatingBar"
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:layout_centerHorizontal="true"
                        />

                </RelativeLayout>

                <LinearLayout
                    android:id="@+id/Rationg_Bottom_LinearLayout"
                    android:orientation="horizontal"
                    android:layout_below="@id/Fifth_Relative"
                    android:layout_above="@+id/Sixth_Relative"
                    android:layout_width="match_parent"
                    android:paddingBottom="5dp"
                    android:layout_height="3dp"
                    android:background="#ff009d"
                    android:layout_centerHorizontal="true">
                </LinearLayout>

            <RelativeLayout
                android:id="@+id/Sixth_Relative"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#ffffff"
                android:layout_marginTop="10dp"
                android:layout_marginLeft="5dp"
                android:layout_below="@+id/Fifth_Relative"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true">

                <TextView
                    android:id="@+id/Sixth_TextView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/Sixth_TextView1"
                    android:layout_marginLeft="5dp"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true"
                    android:id="@+id/Six_TextView2" />

            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/Seventh_Relative"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="#ffffff"
                android:layout_below="@+id/Sixth_Relative"
                android:layout_marginTop="20dp"
                android:layout_marginLeft="5dp"
                android:layout_alignParentLeft="true"
                android:layout_alignParentStart="true">

                <TextView
                    android:id="@+id/Seventh_TextView1"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"/>

                <TextView
                    android:id="@+id/Seventh_TextView2"
                    android:layout_below="@id/Seventh_TextView1"
                    android:layout_marginLeft="5dp"
                    android:layout_marginRight="5dp"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    />

                <Button
                    android:id="@+id/Show_More_Button"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/Seventh_TextView2"
                    android:layout_alignParentBottom="true"
                    android:layout_alignParentLeft="true"
                    android:layout_alignParentStart="true" />


            </RelativeLayout>

            <LinearLayout
                android:id="@+id/Eight_LinearLayout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="horizontal"
                android:layout_marginTop="20dp"
                android:layout_below="@+id/Seventh_Relative">

                   <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"


android:layout_marginLeft="5dp"
android:textSize="20dp" />

</LinearLayout>

 <HorizontalScrollView
 android:id="@+id/HorizontalScrollView"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 android:layout_below="@+id/Eight_LinearLayout"
 android:layout_marginTop="10dp"
 android:layout_alignParentLeft="true"
 android:layout_alignParentStart="true">

 <LinearLayout
 android:layout_width="wrap_content"
 android:layout_height="wrap_content"
 android:orientation="horizontal">

 <ImageView
 android:id="@+id/ScrollView_Image1"
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 />
 <ImageView
 android:id="@+id/ScrollView_Image2"
 android:layout_width="wrap_content"
 android:layout_height="match_parent"
 />
 
 </LinearLayout>

 </HorizontalScrollView>

 <LinearLayout
 android:id="@+id/video1"
 android:orientation="vertical"
 android:layout_marginTop="20dp"
 android:layout_marginBottom="20dp"
 android:layout_marginLeft="20dp"
 android:layout_marginRight="20dp"
 android:layout_width="wrap_content"
 android:layout_height="wrap_content">

 <TextView
 android:id="@+id/Main_Media"
 android:layout_width="match_parent"
 android:layout_height="wrap_content"
 />

 <VideoView
 android:id="@+id/videoview"
 android:layout_width="wrap_content"
 android:layout_height="400dp"
 android:clickable="true"
 android:visibility="visible"
 android:layout_marginTop="@dimen/activity_vertical_margin" />

 </LinearLayout>

 </LinearLayout>

 </ScrollView>

</LinearLayout>

답변 달기

· 글에 소스 코드 보기 좋게 넣는 법
· 질문에 대해 추가적인 질문이나 의견이 있으면 답변이 아니라 댓글로 달아주시기 바랍니다.
표시할 이름 (옵션):
개인정보: 당신의 이메일은 이 알림을 보내는데만 사용됩니다.
스팸 차단 검사:
스팸 검사를 다시 받지 않으려면 로그인하거나 혹은 가입 하세요.
...