Android

レイアウトの定義

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">
  <Button  
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="ボタン" />
</LinearLayout>

 UI構造に関するいい資料があります。
http://d.hatena.ne.jp/bs-android/20090218

レイアウトの制御

public class TestAndriodActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        //内容の取得
        String str1="";
        EditText editText1 =(EditText)findViewById(R.id.editText1);
        str1=editText1.getText().toString();
        
        //内容の設定
        EditText editText2 =(EditText)findViewById(R.id.editText2); 
        editText2.setText(str1.toCharArray(), 0, str1.length());
    }
}


★月額105円~/容量最大30GB/機能満載! ロリポップ!レンタルサーバー ★

コメント:



(画像の文字列を入力して下さい)

トップ   編集 凍結 差分 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2019/12/02 (月) 12:32:38 (1627d)

yVoC[UNLIMITȂ1~] ECirŃ|C Yahoo yV LINEf[^[Ōz500~`I


z[y[W ̃NWbgJ[h COiq 萔O~ył񂫁z COsیI COze