我正在创建一个应用程序,它是一个城市的导游。我在每个类别中都有诸如食物、景点等类别,我使用自定义数组适配器制作了一个列表视图。数组列表中包含图像、每个地方的描述和地址。我正在尝试为地址部分设置一个 onclick 侦听器,当单击它时,它将拉出带有该位置的地图。到目前为止,这是我的代码。我收到 Override onClick 的错误消息,说“方法不会覆盖来自它的超类的方法”。'public class DinnerFragment extends Fragment {public DinnerFragment() { // Required empty public constructor}@Overridepublic View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.list_view, container, false); final TextView address = (TextView) rootView.findViewById(R.id.address); //Create a list for locations ArrayList<List> locations = new ArrayList<List>(); locations.add(new List("Coconuts", "Chill, beachy hangout on the Intracoastal dishing seafood & Sunday brunch while yachts cruise by.", "429 Seabreeze Blvd, Fort Lauderdale, FL 33316" , R.drawable.coconuts)); locations.add(new List("Trulucks","Upscale seafood & steak chain featuring half-price happy hours, a deep wine list & swanky surrounds", "2584A E Sunrise Blvd, Fort Lauderdale, FL 33304", R.drawable.trulucks )); locations.add(new List("Pirate Republic", "Lively riverfront spot with a Caribbean-Mediterranean menu, live music & weeknight happy hour.", "400 SW 3rd Ave, Fort Lauderdale, FL 33315", R.drawable.pirate_republic )); locations.add(new List("15th Street Fisheries", "Veteran marina eatery dishing upscale & casual fare with live music & tarpon feeding from the dock.", "1900 SE 15th St, Fort Lauderdale, FL 33316", R.drawable.fifthteenthst_fisheries)); locations.add(new List("Shooters Waterfront","Laid-back spot on the Intracoastal Waterway offering food, drinks, live music & water views.","3033 NE 32nd
添加回答
举报
0/150
提交
取消