私の質問が本当に何か関係があるのか よくわかりません.Gleeo Time Trackerlistview
というアプリがあり、ここにそのスクリーンビューがあります.記号を押すと、新しいアイテムが作成され、1つのアイテムを削除できます.さらに、アイテムの左側にある録音ボタンをクリックすると、背景が変わります。"+"
"-"
私の質問は、最終的にはリストビューとは何ですか? どうすればそんなことを達成できますか?ありがとうございます!
私の質問が本当に何か関係があるのか よくわかりません.Gleeo Time Trackerlistview
というアプリがあり、ここにそのスクリーンビューがあります.記号を押すと、新しいアイテムが作成され、1つのアイテムを削除できます.さらに、アイテムの左側にある録音ボタンをクリックすると、背景が変わります。"+"
"-"
私の質問は、最終的にはリストビューとは何ですか? どうすればそんなことを達成できますか?ありがとうございます!
あなたがしたいことは、カスタム ListView を構築することです。これは、たとえば、レイアウト ファイルを提供することによって行われます。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/transparent">
<ImageView android:id="@+id/Plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent" />
<TextView android:id="@+id/Title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@android:color/transparent" />
</LinearLayout>
このレイアウトは、アダプタの getView() メソッドをオーバーライドすることで、ListView の各行に適用されます。たとえば、次のようになります。
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) MyActivity.this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.row, null);
}
ImageView plus = (ImageView) v.findViewById(R.id.plus);
icon.setImageDrawable(BrowseActivity.this.getResources().getDrawable(R.drawable.plus));
TextView title = (TextView) v.findViewById (R.id.Browse_FileName);
// add a listener to your button and you're done
return v;
}
開発者ドキュメントのリストビューについて読んでください。ここに例があります