こんにちは、私はあなたの助けが必要です。 私はlistViewの位置をクリックするたびに、アクティビティ を膨らませたいと思います。そのレイアウトに応じて、レイアウトを別のイメージとテキストで表示したいのですが。これは...あなたの助け新しいアクティビティを作成し、別のリソースを設定してください
public class WalkFragment extends Fragment {
public WalkFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
final View rootView = inflater.inflate(R.layout.word_list, container, false);
final ArrayList<word> walk = new ArrayList<>();
walk.add(new word("Παλιά Πόλη", "Περπάτημα", R.drawable.old_town));
walk.add(new word("Φορτέτζα", "Περπάτημα", R.drawable.forteza));
walk.add(new word("Παραλία", "Περπάτημα", R.drawable.paralia));
walk.add(new word("Δημοτικός Κήπος", "Περπάτημα", R.drawable.khpos));
walk.add(new word("Περιφεριακό", "Περπάτημα", R.drawable.periferiakos));
final WordAdapter adapter =
new WordAdapter(getActivity(), walk);
final ListView listView = (ListView) rootView.findViewById(R.id.list);
listView.setAdapter(adapter);
// Set a click listener to inflate and populate the place_layout and InfoActivity
// with a string from strings.xml and an image from drawable
// when the list item is clicked on
// the imageView is mImageView and textView is mTextView that i need to
// populate each time i click on a different position in the listView
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) {
if (position == 0) {
Intent infoActivity = new Intent(getContext(), InfoActivity.class);
startActivity(infoActivity);
} else if (position == 1) {
Intent infoActivity = new Intent(getContext(), InfoActivity.class);
startActivity(infoActivity);
}
}
});
return rootView;
}
}
PleaあなたのアプローチのSEの検索、あなたは例と説明を持つ解決策を得るでしょう –