티스토리 뷰
728x90
출처 : http://tigerwoods.tistory.com/12
http://vulpecula.tistory.com/3
http://nashorn.tistory.com/74
http://blog.vizpei.kr/94697746
http://www.jopenbusiness.com/tc/oss/entry/Android-ScrollView%EB%A1%9C-%ED%99%94%EB%A9%B4-%EC%8A%A4%ED%81%AC%EB%A1%A4-%EC%B2%98%EB%A6%AC
http://songdroid.blogspot.com/2009/12/linearlayout.html
main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" /> </LinearLayout>ScrollViewTest.java
package com.shryu.test; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.view.LayoutInflater; import android.widget.LinearLayout; import android.widget.LinearLayout.LayoutParams; import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.TextView; public class ScrollViewTest extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); //setContentView(R.layout.main); LayoutInflater inflate = LayoutInflater.from(this); LinearLayout layout = (LinearLayout)inflate.inflate(R.layout.main, null); this.setContentView(layout); // ScrollView sv = new ScrollView(this); sv.setLayoutParams(new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); layout.addView(sv); LinearLayout subLayout = new LinearLayout(this); subLayout.setLayoutParams(new LinearLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT, 1.0f)); subLayout.setOrientation(LinearLayout.VERTICAL); subLayout.setPadding(0, 0, 5, 0); sv.addView(subLayout); for (int i=0; i<20; i++) { TextView aa = new TextView(this); aa.setBackgroundColor(Color.BLUE); aa.setText("blue - " + i); subLayout.addView(aa); TextView aa2 = new TextView(this); aa2.setBackgroundColor(Color.BLACK); aa2.setText("black - " + i); subLayout.addView(aa2); } } }
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 튜닝쇼 2008
- 레이싱모델 익스트림 포토 페스티벌
- Linux
- Spring MVC
- Delphi Tip
- MySQL
- SAS
- Xcode
- KOBA
- 동경
- NDK
- ubuntu
- flex
- JavaScript
- Delphi
- android
- ffmpeg
- koba2010
- sas2009
- 전예희
- 서울오토살롱
- ble
- 지스타2007
- Java
- 일본여행
- Spring
- oracle
- Mac
- BPI-M4
- 송주경
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
글 보관함