android:textColor
は、textViewsの束を含むlinearLayoutに対してプログラム的に行う方法はありますか?あなたのLinearLayoutにIDを与えていると仮定すると、programmatically linearLayoutのテキスト色
1
A
答えて
2
、これは動作するはずです:SETTEXTCOLOR `呼び出す` LinearLayout`の子供以上
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.linear_layout);
TextView textView;
for (int i=0; i<linearLayout.getChildCount();i++)
{
View view = linearLayout.getChildAt(i);
if (view instanceof TextView){
textView = (TextView) view;
textView.setTextColor(getResources().getColor(R.color.colorAccent));
}
}
+0
ありがとう、それは私には役に立ちました。 – MyMy
0
((ViewGroup) findViewById(android.R.id.content));
for (int i = 0; i < count; i++) {
View view = viewGroup.getChildAt(i);
if (view instanceof TextView){
TextView text= (TextView) view;
text.setTextColor(Color.WHITE);
}
}
関連する問題
- 1. 空のFileUploadテキストProgrammatically
- 2. Tab host autoscroll - Programmatically
- 3. SwipeRefresh Programmatically
- 4. OpenOffice Search Sheet Programmatically
- 5. UISwitch:Swift 3:Programmatically
- 6. Programmatically Fling ListView Android
- 7. Sitecore Update NameValueList Programmatically
- 8. Programmatically Yahoo!を取得
- 9. Programmatically disown/nohup in Python
- 10. Blackberry invoke button Click Programmatically
- 11. Android - フラグメントとレイアウトのパラメータセットPROGRAMMATICALLY
- 12. Laravel new db with migrations programmatically
- 13. LinearLayoutの仕切りの色を変更します
- 14. ListPreferenceのテキストの色
- 15. アクションバーのテキストの色
- 16. スピナーのテキストの色
- 17. クローズドスピナーのテキストの色
- 18. オーバーライドテーマのテキストの色
- 19. JavaのLinearLayoutとTextViewで色を変更する(Android)
- 20. objective-cテキストの色
- 21. selected menuテキストの色
- 22. テキストの多色グラデーション
- 23. Androidセレクター&テキストの色
- 24. 背景色に基づくテキストの色
- 25. 崇高なテキストの変更テキストの色
- 26. int値からのテキストとテキストの色
- 27. LinearLayoutで2つの画像とテキストを整列する
- 28. Androidのアクションバーのテキストの色
- 29. NativeScriptのボタンのテキストの色
反復、()を ''あるのTextView instanceofは、すべての子どもたちに'。 – CommonsWare
http://stackoverflow.com/questions/7361135/how-to-change-color-and-font-on-listview – Vyacheslav