menu


2016年5月13日金曜日

アンドロイドアプリ作成文字列色背景色変更


色を変えてみましょう!
main.xmlファイルを開いて以下の赤字を追加して下さい。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center"
    android:background="#ff0000">

    <TextView
        android:text="@string/hello_world"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#00ff00" />
<Button
android:text="button"
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#0000ff" >
</Button>

</LinearLayout>
▷ボタンで実行してみて下さい。

いかがでしょうか?色が変わりました。色は#を付けて16進数で表します。00からffまで、並びは、赤緑青の順になります。この組み合わせで、いろんな色に変更できます。


0 件のコメント:

コメントを投稿