EX1 : 프로젝트 생성, Textview 추가

EX2 : TextView에 내용 넣기


ToyList를 보면 수 많은 장난감이 있으나 실제 보이는 장남감 갯수는 처음 몇 개 뿐이다.


화면길이를 넘어가기 때문인데

이 경우 ScrollView로 감싸주면 해결된다.


TODO 확인


<!--TODO (1) Add a ScrollView around the TextView so you can scroll through the list of toys-->

ScrollView로 TextView를 감싼다.

<ScrollView
        android:layout_width=""
        android:layout_height="">
        <TextView...>
</ScrollView>


<!--TODO (2) Make the width of the ScrollView match_parent and the height wrap_content-->

ScrollView내 속성을 width=match_parent, height=wrap_content 로 한다.


<ScrollView
        android:layout_width="match_parent"
        android:layout_height="wrap_content">


전체 소스

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>

<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/tv_toy_names"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
android:padding="16dp"
android:textSize="20sp" />
</ScrollView>
</FrameLayout>


실행해보면 Scroll이되어 모든 장난감 목록을 볼 수 있다.


728x90
BLOG main image
"그게 뭐 어쨌다는 거냐?" 늘 누가 나에게 나에대한 말을할 때면 이말을 기억해라. by nobang

카테고리

nobang이야기 (1932)
Life With Gopro (7)
Life With Mini (79)
Diary (971)
너 그거 아니(do you know) (162)
난 그래 (158)
Study (290)
속지말자 (10)
Project (34)
Poem (15)
Song (0)
Photo (113)
낙서장 (45)
일정 (0)
C.A.P.i (2)
PodCast (0)
nobang (27)
고한친구들 (4)
recieve (0)
History (0)
android_app (2)

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

Total :
Today : Yesterday :