Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
本のテキストを表示するための ListView を実装しました。テキストのすべての段落が ListView の項目 (TextView) になるようにします。しかし、アイテムがフォーカスまたは選択されてクリックされたときに、アイテムを互いに区別したくありません。だから、私<selector>はListViewに使用しました。しかし、私はアイテムの背景をカスタマイズすることができました!
<selector>
では、テキストの色など、リスト項目の前景をカスタマイズしたい場合、どうすればよいでしょうか?
リスト項目の独自の xml レイアウトを作成して、アダプターに配置できます。たとえばSimpleAdapter、コンストラクターは次のようになります。
SimpleAdapter
SimpleAdapter adapter = new SimpleAdapter(context, list, R.layout.your_item_style, from, to) // where "your_item_style" is name of xml file in layout folder of your app