を働いていない。またのTextView SETTEXTCOLOR()私はプログラム的な要素のリスト(なしリストビュー、ちょうど親に追加すること)を作成
<LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_weight="1">
<TextView android:id="@+id/filiale_name"
android:layout_width="fill_parent" android:layout_height="wrap_content"/>
<TextView android:id="@+id/lagerstand_text"
android:layout_width="fill_parent" android:layout_height="wrap_content"
android:textSize="10sp" android:textColor="@color/red"/>
</LinearLayout>
を、私は値/ colors.xmlにいくつかの色を定義しています。ご覧のように、idが "lagerstand_text"のTextViewはデフォルトで赤色に設定されています。それは動作します。 Javaでの要素を作成する場合は
、私は
lagerstandText.setText("bla");
といくつかの要素のために何も私は
lagerstandText.setTextColor(R.color.red);
や他の色を行います。要素がどの私はSETTEXTCOLORを呼び出すことはありませんが(は)私は(それが再び同じ赤だ場合でも)選んだのどの色にかかわらず、他のすべては灰色で、赤ではありません。
なぜですか?
をそれを追加しますあなたは答えを受け入れることができます –