我从某个地方得到了这段代码并对其进行了编辑。你能告诉我如何从起始项目中删除那些单选按钮????我在所有列表项的右侧都有单选按钮。我不想要那个...没有 XML 文件。
package com.example.diseasedetection;
import android.os.Bundle;
import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.Toast;
public class Desc extends ListActivity {String[] trekloc =
{"VIEW INFO","","PLEASE SELECT THE DISEASE","MALARIA","CONJUNCTIVITIS","MIGRANE"
};
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
getListView().setChoiceMode(1);
setListAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_single_choice, trekloc));
}
public void onListItemClick(ListView parent, View v, int position, long id)
{
Toast.makeText(this, trekloc[position] + " selected ", Toast.LENGTH_SHORT).show();
Intent i = new Intent("com.example.diseasedetection.Dispdesc");
Bundle extras = new Bundle();
extras.putString("Name", trekloc[position]);
i.putExtras(extras);
startActivity(i);
}
}