如何提高android布局渲染的性能
我的android应用程序有8个模板布局 它们有不同的风格,比如重量,线的数量,有图标吗 它总是改变屏幕 它从充气模板布局所有8个布局开始如何提高android布局渲染的性能,android,performance,templates,layout,render,Android,Performance,Templates,Layout,Render,我的android应用程序有8个模板布局 它们有不同的风格,比如重量,线的数量,有图标吗 它总是改变屏幕 它从充气模板布局所有8个布局开始 view1 = getLayoutInflater().inflate(R.layout.template_1, null); view2 = getLayoutInflater().inflate(R.layout.template_2, null); . . . view8 = getLayoutInflater().inflate(R.layout.t
view1 = getLayoutInflater().inflate(R.layout.template_1, null);
view2 = getLayoutInflater().inflate(R.layout.template_2, null);
.
.
.
view8 = getLayoutInflater().inflate(R.layout.template_8, null);
并映射所有组件
layout = (LinearLayout) view.findViewById(R.id.layoutID);
line1 = (TextView) view1.findViewById(R.id.line1ID);
line2 = (TextView) view.findViewById(R.id.line2ID);
icon = (ImageView) view.findViewById(R.id.iconID);
我的代码正在检查模板的名称
范例
模板1
然后将view1添加到大型机
并配置所有组件
icon.setImageDrawable(....);
line1.setText(....);
line2.setText(....);
layout.setBackgroundColor(....);
这些都是我的步骤
谢谢您您使用哪一类进行分页?使用
ViewPager
您可以通过ViewPager.OnPageChangeListener(int preload PageCount)
预加载远邻页面,从而缩短加载时间。只需新的xml文件您使用哪个类进行分页?使用ViewPager
可以通过ViewPager.OnPageChangeListener(int preload PageCount)
预加载远邻页面,从而缩短加载时间。只需新建xml文件即可