ラベル android の投稿を表示しています。 すべての投稿を表示
ラベル android の投稿を表示しています。 すべての投稿を表示

2013年6月12日水曜日

[android]各ビューの画面幅に占める割合設定

各ビューのlayout_width を 0dip と設定し、layout_weight に 画面に占める割合を設定する。
(例)textView1 と textView2 を 7:3の割合で表示させる。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="0dip"
        android:layout_weight="7"
        android:layout_height="wrap_content" />

    <TextView
        android:id="@+id/textView2"
        android:layout_width="0dip"
        android:layout_weight="3"
        android:layout_height="wrap_content" />

</LinearLayout>




2013年6月2日日曜日

[Android]R.javaが生成されない

【問題】
[プロジェクト]>[クリーン]を実行してもR.javaが生成されない([自動的にビルド]のチェックあり)
[プロジェクト]>[すべてビルド]を選択してもビルドが実行されない

【理由】
R.javaはリソースIDを管理しているファイル。
xmlファイル内でエラーが発生しているため、自動解決できずにいる状態。

【対策】
Manifest.xml以外のxmlファイルで発生しているエラーを全て取り除く

[WinMerge、Android]Android用フィルタ

WinMergeのAndroid用フィルタ

## This is a directory/file filter template for WinMerge
name: Android
desc: Suppresses various binaries found in Android source trees

## Select if filter is inclusive or exclusive
## Inclusive (loose) filter lets through all items not matching rules
## Exclusive filter lets through only items that match to rule
## include or exclude
def: include

## Filters for filenames begin with f:
## Filters for directories begin with d:
## (Inline comments begin with " ##" and extend to the end of the line)

f: \.class$ ## class file

d: \\classes$ ## class files

2013年5月31日金曜日

[android]Rを変数に解決できません

【問題】
何かの拍子に「Rを変数に解決できません」というエラーメッセージがでる。

【原因】
genフォルダ内のR.javaのコンパイルに失敗している際に表示される。

【対策】
メニューバーより[プロジェクト]>[クリーン]を選択し、プロジェクト内のオブジェクトを削除させる。
⇒オブジェクト削除後、自動ビルドが実行される際にR.javaも自動生成され問題が解消される。

R.javaが生成されない