[안드로이드,Android]seekbar ,시크바
2013. 2. 7. 09:16ㆍMobile/Android
반응형
MainActivity.java
package com.example.ggari_seekbar; import android.app.Activity; import android.os.Bundle; import android.widget.SeekBar; import android.widget.TextView; public class MainActivity extends Activity { SeekBar seekbar; TextView tv_val; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); seekbar=(SeekBar)findViewById(R.id.seekbar); tv_val=(TextView)findViewById(R.id.tv_val); seekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() { public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { tv_val.setText(" 현재 값 : " + progress); } public void onStartTrackingTouch(SeekBar seekBar) {} public void onStopTrackingTouch(SeekBar seekBar) {} }); } }activity_main.xml
<?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" android:orientation="vertical" > <SeekBar android:id="@+id/seekbar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:max="100" android:progress="50" /> <TextView android:id="@+id/tv_val" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text=" 현재 값 : 50 " /> </LinearLayout>
반응형
'Mobile > Android' 카테고리의 다른 글
안드로이드 sdk 설치 및 다운 (1) | 2013.02.14 |
---|---|
[안드로이드,Android]종료 다이얼로그 (0) | 2013.02.08 |
[안드로이드,Android]스피너,Spinner (0) | 2013.02.06 |
[안드로이드,Android]WebView,웹뷰 (1) | 2013.02.05 |
[안드로이드]프로그레스바,ProgressBar (0) | 2013.01.30 |