私はコードを表示するために簡単なアダプタを使用しています。残念ながら、私はトップのtextViewの色を変更する必要があります。android.R.layout.simple_list_item_2のテキストの色を変更してください
これは私のコードの抜粋です:
// Keys used in Hashmap
String[] from = { "txt1", "txt2" };
// Ids of views in listview_layout
int[] ids = { android.R.id.text1, android.R.id.text2 };
SimpleAdapter adapter = new SimpleAdapter(this, aList,
android.R.layout.simple_list_item_2, from, ids);
setListAdapter(adapter);
私は自分simple_list_item_2を作ってみましたが、それは私が何らかの理由でXMLでのTextViewの色を変更することができません。これを行う方法に関するアイデア?
私の最後の思考は次のとおりです。
findViewById(android.R.id.text1).setTextColor(#000)
が、私はそれをどこに置くか分からない、と私の進コードは動作しません。
16進数のカラーを渡すには、 'setTextColor(Color.parseColor("#YOURCOLOR "))'を使用する必要があります。ただし、これはカスタムアダプターなしでは機能しません。 –