Change TextSize of EditText programmically - Hallo sahabat Teknologi Terbaru, Pada Artikel yang anda baca kali ini dengan judul Change TextSize of EditText programmically, kami telah mempersiapkan artikel ini dengan baik untuk anda baca dan ambil informasi didalamnya. mudah-mudahan isi postingan yang kami tulis ini dapat anda pahami. baiklah, selamat membaca.
Judul : Change TextSize of EditText programmically
link : Change TextSize of EditText programmically
Change TextSize of EditText programmically
To set TextSize of EditText, call its setTextSize() method.package com.example.androidedittext;
import android.os.Bundle;
import android.app.Activity;
import android.widget.EditText;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;
import android.widget.TextView;
public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final EditText input = (EditText)findViewById(R.id.input);
input.setTextSize(28);
SeekBar seekbarScale = (SeekBar)findViewById(R.id.sbsize);
final TextView textScale = (TextView)findViewById(R.id.textsize);
seekbarScale.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
int size = progress+1;
input.setTextSize(size);
textScale.setText(String.valueOf(size));
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
// TODO Auto-generated method stub
}});
}
}
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity" >
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="android-coding.blogspot.com" />
<SeekBar
android:id="@+id/sbsize"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="50"
android:progress="28"/>
<TextView
android:id="@+id/textsize"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<EditText
android:id="@+id/input"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
Demikianlah Artikel Change TextSize of EditText programmically
Sekianlah artikel Change TextSize of EditText programmically kali ini, mudah-mudahan bisa memberi manfaat untuk anda semua. baiklah, sampai jumpa di postingan artikel lainnya.
0 Response to "Change TextSize of EditText programmically"
Post a Comment