【发布时间】:2015-12-29 11:20:47
【问题描述】:
setText() 函数有一个奇怪的问题。当我单击特定项目时,我想显示 listview 项目详细信息。我想在 3 个选项卡中显示此详细信息,因此我使用 fragments。这是我其中之一的代码。
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Intent intent = getActivity().getIntent();
int position = intent.getExtras().getInt("Position");
View rootView = inflater.inflate(R.layout.album_tab1, container, false);
Log.e("Position", String.valueOf(position));
Log.e("Value: ", ParseJSONDetail.overview[position]);
final TextView title = (TextView) rootView.findViewById(R.id.album_title);
final TextView overview = (TextView) rootView.findViewById(R.id.album_overview);
final TextView band = (TextView) rootView.findViewById(R.id.album_band);
final ImageView okladka = (ImageView) rootView.findViewById(R.id.album_okladka);
overview.setText(ParseJSONDetail.overview[position]);
imgload.getInstance().displayImage(ParseJSONDetail.image[position], okladka);
band.setText(ParseJSONDetail.band[position]);
title.setText(ParseJSONDetail.title[position]);
return inflater.inflate(R.layout.album_tab1, container, false);
}
奇怪的是,在日志中我可以显示我想要的数据。 知道这段代码有什么问题吗?
【问题讨论】:
标签: android android-fragments settext