
package test.com;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
public class text extends Activity {
/** Called when the activity is first created. */
private TextView mTextView01;
private TextView mTextView02;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mTextView01 =(TextView)findViewById(R.id.TwFirstLine);
mTextView01.setText("即期匯率\n銀行賣出33.3");
mTextView01 =(TextView)findViewById(R.id.TwSecondLine);
mTextView01.setText("銀行買進33.2");
}
}
---------------------------------------------------main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/widget42"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical" xmlns:android="http://schemas.android.com/apk/res/android">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80px"
android:padding="6dip">
<ImageView android:id="@+id/icon"
android:layout_width="100px"
android:layout_height="fill_parent"
android:layout_marginRight="6dip"
android:src="@drawable/tw" />
<TextView
android:id="@+id/FirstLine"
android:layout_toRightOf="@id/icon"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="台幣" />
<TextView
android:id="@+id/secondLine"
android:layout_toRightOf="@id/icon"
android:layout_below="@+id/FirstLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="目前匯率33" />
</RelativeLayout>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="80px"
android:padding="6dip">
<ImageView android:id="@+id/icon"
android:layout_width="100px"
android:layout_height="fill_parent"
android:layout_marginRight="6dip"
android:src="@drawable/usd" />
<TextView
android:id="@+id/FirstLine"
android:layout_toRightOf="@id/icon"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="美元" />
<TextView
android:id="@+id/secondLine"
android:layout_toRightOf="@id/icon"
android:layout_below="@+id/FirstLine"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="目前匯率0.34045" />
</RelativeLayout>
</LinearLayout>
沒有留言:
張貼留言