example)
1. Layout (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:id="@+id/textview01" android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
2. Source (MainActivity.java)
........
setContentView(R.layout.main);
TextView l_textView = (TextView) findViewById(R.id.textview01);
l_textView.setBackgroundResource(R.drawable.add_to_my_list);
l_textView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
l_textView.setTextColor(Color.BLACK);
l_textView.setTextSize(15);
l_textView.setText("Fighting!");
..............
'Android' 카테고리의 다른 글
Android disable screen timeout while app is running (0) | 2011.08.19 |
---|---|
ViewStub (0) | 2011.06.02 |
padding & margin (0) | 2011.04.29 |
RGB hexadecimal code (0) | 2011.04.15 |
ISO 3166-2 (0) | 2011.04.07 |