【发布时间】:2015-07-23 12:51:31
【问题描述】:
我有一个包含主要片段和历史片段的视图寻呼机。
当历史片段为空时,我使用setBackgroudResource 在那里设置了一个图像,但是 UI 非常慢。
滑动、手势、事件。有什么原因呢?
我尝试多次压缩PNG图像文件,所以可能不是因为文件大小。
@Override
public View onCreateView( LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState )
{
View view = inflater.inflate( R.layout.fragment_history, container, false );
histroyListAdapter = new PasswordAdapter( historyList );
setListAdapter(histroyListAdapter);
noHistoryImage = (ImageView) view.findViewById( R.id.noHistroySign );
putSignIfEmpty();
....
}
.......
private void putSignIfEmpty()
{
if( historyList.isEmpty() )
{
noHistoryImage.setVisibility( View.VISIBLE );
}
else
{
noHistoryImage.setVisibility( View.INVISIBLE );
}
}
【问题讨论】:
-
这是很多代码。我应该发布哪些具体部分?
-
从添加图片资源的地方开始
-
@DavidM 编辑了原始帖子。非常感谢。
标签: android performance user-interface android-fragments fragment