Android button text alignment left right - sample
android:gravity="left|center_vertical" or android:gravity="right|center_vertical"
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="left|center_vertical"
android:paddingLeft="20dp"
android:text="My Button"
/>
396LW NO topic_id
AD
Další témata ....(Topics)
FLAG_KEEP_SCREEN_ON saving energy. Protects the battery if a user closing applications using the Return button on device. The device will returned to user screen mode settings.
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
//..........
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}
Try insert + before R.drawable.xxxx
// error
InputStream is = context.getResources().openRawResource(R.drawable.app_sample_code);
// ok
InputStream is = context.getResources().openRawResource(+R.drawable.app_sample_code);
TimerTask with updating of TextView here
//android.okhelp.cz/asynctask-example-android-with-progressbar/
//android.okhelp.cz/timer-task-timertask-run-cancel-android-example/
package cz.okhelp.timer;
import java.util.Timer;
import java.util.TimerTask;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class TimerActivity extends Activity {
TextView hTextView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
hTextView = (TextView)findViewById(R.id.idTextView);
MyTimerTask myTask = new MyTimerTask();
Timer myTimer = new Timer();
// public void schedule (TimerTask task, long delay, long period)
// Schedule a task for repeated fixed-delay execution after a specific delay.
//
// Parameters
// task the task to schedule.
// delay amount of time in milliseconds before first execution.
// period amount of time in milliseconds between subsequent executions.
myTimer.schedule(myTask, 3000, 1500);
}
class MyTimerTask extends TimerTask {
public void run() {
// ERROR
hTextView.setText("Impossible");
// how update TextView in link below
// //android.okhelp.cz/timer-task-timertask-run-cancel-android-example/
System.out.println("");
}
}
}
//android.okhelp.cz/asynctask-example-android-with-progressbar/
//android.okhelp.cz/timer-task-timertask-run-cancel-android-example/
Motorola Droid X cena od 3 000 KCZ Kč (únor.2012)
Spokojenost uživatelů nadprůměrná.
Motorola Droid X je chytrý telefon s operačním systémem Android.
Motorola Droid X je (22.února2012) 8. nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.
Android 2.1
Display 854 x 480 pixelů
8 megapixel fotoaparát dual LED flash
720p HD video recording
Music and Video player
8 GB paměť
rozšíření paměti 32 GB
WiFi/DLNA
TI OMAP3630 processor – 1GHz
4.3-inch large display
Motorola Droid X photo pic image
Zdroj obrázku: wikipedia
Spokojenost uživatelů nadprůměrná.
Motorola Droid X je chytrý telefon s operačním systémem Android.
Motorola Droid X je (22.února2012) 8. nejpoužívanějším chytrým telefonem u programu Sky Map viz tabulka.
Android 2.1
Display 854 x 480 pixelů
8 megapixel fotoaparát dual LED flash
720p HD video recording
Music and Video player
8 GB paměť
rozšíření paměti 32 GB
WiFi/DLNA
TI OMAP3630 processor – 1GHz
4.3-inch large display
Motorola Droid X photo pic image
Zdroj obrázku: wikipedia
GregorianCalendar cal = new GregorianCalendar(); Boolean b = cal.isLeapYear(2012); // true, Android example.
public class MainActivity extends Activity {
TextView txtV;
Context cntx;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
txtV = (TextView)findViewById(R.id.idLabel);
cntx = this;
StringBuilder strBuild = new StringBuilder();
GregorianCalendar cal = new GregorianCalendar();
Boolean b = cal.isLeapYear(2012); // true
strBuild.append("Is leap year 2012? " + b + "
");
b = cal.isLeapYear(2014); // false
strBuild.append("Is leap year 2014? " + b + "
");
txtV.setText(strBuild);
}
}
Editace: 2011-10-30 11:25:20
Počet článků v kategorii: 396
Url:android-button-textalignment