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

프로그램이 시작할때, 왜 화면의 맨 아래쪽으로 이동해져있는지 잘 모르겠습니다.

0 추천

 

안녕하세요.

제가 한페이지짜리 코드를 만들었는데 프로그램이 시작할 경우, 위쪽에서 아래쪽으로 스크롤이 이동하도록

하고 싶은데 제 생각과는 다르게, 프로그램이 시작할 때 맨 아래쪽으로 이동이 되어 있어서, 위쪽 내용을 보려

면 아래에서 위로 스크롤을 올려야 하는 반대의 상황이 이루어졌습니다.

 

그런데 이 이유를 찾긴 찾았습니다. 아래쪽에 보면, 리니어 레이아웃으로 구성된 비디오뷰 부분에 있어서

비디오뷰를 제거했을 경우에는 이 문제가 일어나지 않는데, 비디오뷰를 넣는 순간, 아래쪽으로 화면이

포커스가 맞춰져서 문제가 됩니다.. 포커스를 주는 방법을 찾아서 검색을 해보았지만, 쉽게 제 소스에

적용을 시키는게 어려워서.. 도움을 얻고자 글을 올립니다.

 

아래의 소스 첨부해 보겠습니다. 소스의 내용이 정말 별거 없는데, xml의 구조라 좀 길은데..

아래의 댓글 부분에 이어서 달아보겠습니다.

<?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"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

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

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>

        <ImageView
            android:id="@+id/Before_Activity"
            android:layout_width="wrap_content"
            android:layout_toRightOf="@+id/Top_Image_button"
            android:paddingTop="10dp"
            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="5dp"
            android:layout_centerHorizontal="true" />

    </RelativeLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:orientation="horizontal"
        android:background="#000000"
        android:layout_height="3dp"
        ></LinearLayout>


   

 

Kind카인드 (3,600 포인트) 님이 2016년 11월 15일 질문
<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:layout_alignParentTop="true" />

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

                        android:layout_centerVertical="true"
                        android:layout_alignParentRight="true"
                        android:layout_alignParentEnd="true"
                        />

                    <ImageView
                        android:id="@+id/beol"
                        android:layout_width="20dp"
                        android:layout_height="20dp"
                        android:layout_centerVertical="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: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: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_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="7dp"
                        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="8dp"
                        android:layout_marginLeft="3dp"
                        />


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

                    <LinearLayout
                        android:id="@+id/Side"
                        android:orientation="horizontal"
                        android:layout_below="@+id/Information_1"
                        android:layout_width="match_parent"
                        android:layout_height="2dp"
                        android:layout_toRightOf="@id/imageView"
                        android:layout_centerHorizontal="true"
                        android:layout_marginTop="5dp"
                        android:layout_marginBottom="5dp">

                    </LinearLayout>
<TextView
                        android:id="@+id/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"
                        android:text="예제"
                        />

                    <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/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: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: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: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"
                    android:text="출연" />

 

 
<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"
                    android:text=" 컨텐츠 "
                    android:textSize="25dp"
                    android:textStyle="bold" />

                <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:text="보기
                    android:textColor="#bf00ff"
                    android:textStyle="bold"
                    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_marginLeft="10dp"
                android:background="#ffffff"
                android:layout_below="@+id/Seventh_Relative">

                <TextView
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:text="Media"
                    android:textStyle="bold"
                    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"
                    android:text=" Media_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>

답변 달기

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