우분투 리눅스가 10.04 LTS (Long Time Support) 버전이 공개 되었다.
MS의 IE 종속적인 대한민국 인터넷 환경에서는 크게 어필할 수 없겠지만 그래도 상당히 매력적인 운영체제 인 것 같다.
Ubuntu Homepage
Ubuntu 10.04 LTS Features<
Original Post : http://neodreamer-dev.tistory.com/429
progDialog1 = new ProgressDialog( this );
progDialog1.setProgressStyle( ProgressDialog.STYLE_HORIZONTAL );
progDialog1.setMessage( "Test" );
progDialog1.setCancelable( true );
static final int MY_PROGRESS1 = 7;
ProgressDialog progDialog1;
:
:
case R.id.BtnProgress1:
{
showDialog( MY_PROGRESS1 );
new Thread(new Runnable()
{
int nProgress;
@Override
public void run()
{
for(nProgress = 0; nProgress <= 100; ++nProgress )
{
runOnUiThread( new Runnable()
{
public void run()
{
progDialog1.setProgress(nProgress);
}
});
SystemClock.sleep(100);
}
dismissDialog( MY_PROGRESS1 );
}
}).start();
}
break;
// Custom Dialog 생성 예제
Context mContext = getApplicationContext();
Dialog dialog = new Dialog( mContext );
dialog.setContentView(R.layout.custom_dialog);
dialog.setTitle("Custom Dialog");
TextView text = (TextView) dialog.findViewById(R.id.text);
text.setText("Hello, this is a custom dialog!");
ImageView image = (ImageView) dialog.findViewById(R.id.image);
image.setImageResource( R.drawable.icon );
에러 발생 화면
<?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="wrap_content">
<Button
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"/>
<TextView
android:text="@+id/TextView01"
android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<EditText
android:text="@+id/EditText01"
android:id="@+id/EditText01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
//Context mContext = getApplicationContext();
Dialog dialog = new Dialog( this );
dialog.setContentView( R.layout.mydialog );
dialog.setTitle( "MyDialog 1" );
Button btnMyDlg = (Button)dialog.findViewById( R.id.Button01 );
btnMyDlg.setText( "My Button on Custom Dialog" );
dialog.show();
Title 을 지정하지 않는 Dialog
날짜 및 시각 선택 대화상자 호출 버튼 | 날짜 선택 대화상자 | 선택된 날짜 처리 화면 |
날짜 및 시각 선택 대화상자 호출 버튼 | 시각 선택 대화상자 | 선택된 시각 설정 화면 |
TextView tvDate;
Button btnDate;
TextView tvTime;
Button btnTime;
Calendar calDateTime = Calendar.getInstance();
// Date Set Listener
DatePickerDialog.OnDateSetListener dateSetListener =
new DatePickerDialog.OnDateSetListener()
{
@Override
public void onDateSet( DatePicker view, int year, int monthOfYear,
int dayOfMonth )
{
calDateTime.set( Calendar.YEAR, year );
calDateTime.set( Calendar.MONTH, monthOfYear );
calDateTime.set( Calendar.DAY_OF_MONTH, dayOfMonth );
String strDate;
strDate =
Integer.toString( year ) + "/" +
Integer.toString( monthOfYear ) + "/" +
Integer.toString( dayOfMonth );
tvDate.setText( strDate );
}
};
// Time Set Listener
TimePickerDialog.OnTimeSetListener timeSetListener =
new TimePickerDialog.OnTimeSetListener()
{
@Override
public void onTimeSet( TimePicker view, int hourOfDay, int minute )
{
calDateTime.set( Calendar.HOUR_OF_DAY, hourOfDay );
calDateTime.set( Calendar.MINUTE, minute );
String strTime;
strTime =
Integer.toString( hourOfDay ) + ":" +
Integer.toString( minute );
tvTime.setText( strTime );
}
};
:
tvDate = (TextView)findViewById( R.id.TVDate );
btnDate = (Button)findViewById( R.id.BtnDate );
btnDate.setOnClickListener( this );
tvTime = (TextView)findViewById( R.id.TVTime );
btnTime = (Button)findViewById( R.id.BtnTime );
btnTime.setOnClickListener( this );
:
case R.id.BtnDate:
{
// Call Date Picker
new DatePickerDialog(
MyDialog.this,
dateSetListener,
calDateTime.get( Calendar.YEAR ),
calDateTime.get( Calendar.MONTH ),
calDateTime.get( Calendar.DAY_OF_MONTH )
).show();
}
break;
case R.id.BtnTime:
{
// Call Time Picker
new TimePickerDialog(
MyDialog.this,
timeSetListener,
calDateTime.get( Calendar.HOUR ),
calDateTime.get( Calendar.MINUTE ),
true
).show();
}
break;
}
:
Original Post : http://neodreamer-dev.tistory.com/426
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabHost
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="69px"
>
<LinearLayout
android:id="@+id/BtnLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
>
<Button
android:id="@+id/BtnLinearLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Linear Layout"/>
<Button
android:id="@+id/BtnRelativeLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Relative Layout"/>
<Button
android:id="@+id/BtnTableLayout"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Table Layout"/>
</LinearLayout>
</FrameLayout>
</TabHost>
</LinearLayout>
setContentView( R.layout.main_dynamic_tab );
// Tab Host 객체 생성 - 다른 객체의 멤버 함수에서 사용하기 위해 final 키워드 이용
final TabHost tabHost = (TabHost)findViewById( R.id.tabHost );
// TabHost 를 findViewById 로 생성한 후 Tab 추가 전에 꼭 실행해 주어야 함.
tabHost.setup();
// 새로운 Tab 을 생성하기 위한 Tab 객체 생성
TabHost.TabSpec spec;
// 첫 번째 Tab 설정 및 등록
spec = tabHost.newTabSpec( "Tab 00" ); // 새 Tab 생성
spec.setIndicator("Layouts", getResources().getDrawable(R.drawable.icon) ); // Tab 제목, 아이콘
spec.setContent(R.id.BtnLayout); // Tab 내용
tabHost.addTab( spec ); // 생성 된 Tab 등록
// 첫 번째 탭을 활성화
tabHost.setCurrentTab( 0 );
// Linear Layout
Button btnAddLinearLayout = (Button)findViewById( R.id.BtnLinearLayout );
btnAddLinearLayout.setOnClickListener( new OnClickListener()
{
@Override
public void onClick(View v)
{
for ( int view = 0; view < tabHost.getChildCount(); ++view )
{
}
TabHost.TabSpec spec = tabHost.newTabSpec( "Linear Layout" );
spec.setIndicator( "Linear" );
spec.setContent( new TabHost.TabContentFactory()
{
@Override
public View createTabContent(String tag)
{
LinearLayout linear = new LinearLayout( MyLayout.this );
linear.setOrientation( LinearLayout.VERTICAL );
linear.setId( MY_LINEARLAYOUT_VIEW );
LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.FILL_PARENT,
LinearLayout.LayoutParams.WRAP_CONTENT );
linear.setLayoutParams( param );
// EditText
EditText etName = new EditText( MyLayout.this );
etName.setText( "Input your name here!!" );
linear.addView( etName );
// First Button
Button btn = new Button( MyLayout.this );
btn.setText( "First Added Button" );
linear.addView( btn, param );
// Second Button
btn = new Button( MyLayout.this );
btn.setText( "Second Added Button" );
linear.addView( btn, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT ) );
// TextView
TextView tvHello = new TextView( MyLayout.this );
tvHello.setText( "Hello! Linear layout!!" );
tvHello.setGravity( Gravity.CENTER );
linear.addView( tvHello );
// Third Button
btn = new Button( MyLayout.this );
btn.setText( "Third Added Button" );
linear.addView( btn, param );
return linear;
}
});
tabHost.addTab( spec );
}
});
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/IVIcon"
android:src="@drawable/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
<TextView
android:id="@+id/TVCaption"
android:text="Caption"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
/>
</LinearLayout>
TabHost tabHost = (TabHost)findViewById( R.id.tabHost );
// TabHost 를 findViewById 로 생성한 후 Tab 추가 전에 꼭 실행해 주어야 함.
tabHost.setup();
// 새로운 Tab 을 생성하기 위한 Tab 객체 생성
TabHost.TabSpec spec;
// Custom View for TabWidget
LayoutInflater layout = getLayoutInflater();
// 첫 번째 Tab 설정 및 등록
spec = tabHost.newTabSpec( "Tab 00" ); // 새 Tab 생성
View vTab1 = layout.inflate( R.layout.mytabwidget, null );
TextView tvCaption = (TextView)vTab1.findViewById( R.id.TVCaption );
tvCaption.setText( "Custom Tab 1" );
spec.setIndicator( vTab1 ); // Tab 제목
spec.setContent(R.id.layout); // Tab 내용
tabHost.addTab( spec ); // 생성 된 Tab 등록
// 두 번째 Tab 설정 및 등록
spec = tabHost.newTabSpec( "Tab 01" ); // 새 Tab 생성
View vTab2 = layout.inflate( R.layout.mytabwidget, null );
tvCaption = (TextView)vTab2.findViewById( R.id.TVCaption );
tvCaption.setText( "Custom Tab 2" );
spec.setIndicator( vTab2 ); // Tab 제목
spec.setContent( R.id.btnClickme ); // Tab 내용
tabHost.addTab( spec ); // 생성 된 Tab 등록
// 첫 번째 탭을 활성화
tabHost.setCurrentTab( 0 );
<!-- TabWidget 의 높이는 40px 로 설정한 경우 -->
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="40px"
/>
<!-- TabWidget 의 높이는 100px 로 설정한 경우 -->
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="100px"
/>
android:layout_height="40px" | android:layout_height="100px" |
for ( int tab = 0; tab < tabHost.getTabWidget().getChildCount(); ++tab )
{
tabHost.getTabWidget().getChildAt(tab).getLayoutParams().height = 100;
}
height = 40 인 경우 | height = 100 인 경우 |
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/TabView1"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
<LinearLayout
android:id="@+id/TabView2"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
</LinearLayout>
<TextView
android:id="@+id/TabView3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="TabView3"
/>
</FrameLayout>
</LinearLayout>
</TabHost>
package com.neodreamer.MyTab;<
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
public class MyTab extends TabActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost();
TabHost.TabSpec spec;
// 첫 번째 탭
spec = tabHost.newTabSpec( "Tab 01" );
spec.setIndicator( "Tab 01",
getResources().getDrawable( R.drawable.icon ) );
spec.setContent( R.id.TabView1 );
tabHost.addTab( spec );
// 두 번째 탭
spec = tabHost.newTabSpec( "Tab 02" );
spec.setIndicator( "Tab 02" );
spec.setContent( R.id.TabView2 );
tabHost.addTab( spec );
// 세 번째 탭
spec = tabHost.newTabSpec( "Tab 03" );
spec.setIndicator( "Tab 03" );
spec.setContent( R.id.TabView3 );
tabHost.addTab( spec );
tabHost.setCurrentTab( 0 );
}
}
Original Post : http://neodreamer-dev.tistory.com/419
FrameLayout 의 paddingTop 이 설정되지 않은 경우
LinearLayout 컨테이너에 TabWidget 과 FrameLayout 을 담은 경우
<?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"
>
<TabHost
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<AnalogClock
android:id="@+id/clockAnalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
<DigitalClock
android:id="@+id/clockDigital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
<Button
android:id="@+id/btnClickme"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="The Button.\nClick me!"
/>
</FrameLayout>
</TabHost>
</LinearLayout>
<?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"
>
<TabHost
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout
android:id="@+id/layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<AnalogClock
android:id="@+id/clockAnalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
<DigitalClock
android:id="@+id/clockDigital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
<Button
android:id="@+id/btnClickme"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="The Button.\nClick me!"
/>
</FrameLayout>
</LinearLayout>
</TabHost>
</LinearLayout>
Original Post : http://neodreamer-dev.tistory.com/418
Tab 의 구성
Tab Widget
FrameLayout 의 padding-top 이 0px 인 경우
<?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"
>
<TabHost
android:id="@+id/tabHost"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="0px"
>
<LinearLayout
android:id="@+id/layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<AnalogClock
android:id="@+id/clockAnalog"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
<DigitalClock
android:id="@+id/clockDigital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
/>
</LinearLayout>
<Button
android:id="@+id/btnClickme"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="The Button.\nClick me!"
/>
</FrameLayout>
</TabHost>
</LinearLayout>
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = (TabHost)findViewById( R.id.tabHost );
// TabHost 를 findViewById 로 생성한 후 Tab 추가 전에 꼭 실행해 주어야 함.
tabHost.setup();
// 새로운 Tab 을 생성하기 위한 Tab 객체 생성
TabHost.TabSpec spec;
// 첫 번째 Tab 설정 및 등록
spec = tabHost.newTabSpec( "Tab 00" ); // 새 Tab 생성
spec.setIndicator("Clock"); // Tab 제목
spec.setContent(R.id.layout); // Tab 내용
tabHost.addTab( spec ); // 생성 된 Tab 등록
// 두 번째 Tab 설정 및 등록
spec = tabHost.newTabSpec( "Tab 01" ); // 새 Tab 생성
spec.setIndicator( "Button", getResources().getDrawable(R.drawable.icon) ); // Tab 제목
spec.setContent( R.id.btnClickme ); // Tab 내용
tabHost.addTab( spec ); // 생성 된 Tab 등록
// 첫 번째 탭을 활성화
tabHost.setCurrentTab( 0 );
}
<Message 를 갖는 AlertDialog | ListView 를 갖는 AlertDialog |
간단한 AlertDialog
AlertDialog alert = new AlertDialog.Builder( this )
.setIcon( R.drawable.icon )
.setTitle( "AlertTitle" )
.setMessage( "AlertMessage" )
.setPositiveButton( "OK", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
}
})
.show();
Icon과 Title을 제거한 AlertDialog | Icon 없이 Title 만 지정한 AlertDialog |
ListView를 갖는 AlertDialog
String[] strItems = { "Alert Item 1", "Alert Item 2", "Alert Item 3" };
AlertDialog alert = new AlertDialog.Builder( this )
.setIcon( R.drawable.icon )
.setTitle( "AlertTitle" )
.setPositiveButton( "OK", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
}
})
.setNeutralButton( "Neutral", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
}
})
.setNegativeButton( "Cancel", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
}
})
.setSingleChoiceItems(strItems, -1, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
String msg = "";
switch ( which )
{
case 0: msg = "Item 1 Selected"; break;
case 1: msg = "Item 2 Selected"; break;
case 2: msg = "Item 3 Selected"; break;
}
Toast.makeText( MyDialog.this, msg, Toast.LENGTH_SHORT ).show();
}
})
.show();
Custom View 를 얹은 AlertDialog
<?xml version="1.0" encoding="utf-8"?>
<TableLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TableRow>
<ImageView
android:id="@+id/IVIcon1"
android:src="@drawable/icon"
/>
<TextView
android:id="@+id/TVAndroid1"
android:text="Android 1"
/>
</TableRow>
<TableRow>
<ImageView
android:id="@+id/IVIcon1"
android:src="@drawable/icon"
/>
<TextView
android:id="@+id/TVAndroid1"
android:text="Android 1"
/>
</TableRow>
</TableLayout>
LayoutInflater layout2 = getLayoutInflater();
View v2 = layout2.inflate( R.layout.alert_custom_view, null );
AlertDialog alert = new AlertDialog.Builder( this )
.setIcon( R.drawable.icon )
.setTitle( "AlertTitle" )
.setMessage( "AlertMessage" )
.setPositiveButton( "OK", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
dialog.dismiss();
}
})
.setNeutralButton( "Neutral", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
}
})
.setNegativeButton( "Cancel", new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
}
})
.setView( v2 )
.show();
Visual Studio 2010 [출처 : Microsoft]
Team 메뉴의 Share Project... 메뉴
프로젝트 공유 방법 설정 대화상자
Repository 선택 대화상자
프로젝트 위치 설정 대화상자
Commit Comment 대화상자
Comment 및 파일 선택 대화상자
프로젝트 업로드 상황창
Repository 상태