`
yxwang0615
  • 浏览: 559916 次
  • 性别: Icon_minigender_1
  • 来自: 青岛
社区版块
存档分类
最新评论

Use a layout_width of 0dip instead of fill_parent for better performance

 
阅读更多

安装了最新的ATD 18之后,新加的Lint Warnings插件会给我们检测出许多xml布局中不当的地方,例如:

Use a layout_width of 0dip instead of fill_parent for better performance

什么意思呢?举个简单的例子:

这是一个垂直布局,上下的线性布局各占高度50.0dp,中间的的TextView设置了android:layout_weight="1.0"属性,会将剩余空间填充满,这时候TextView的android:layout_width="fill_parent"就没有用了,应该改为android:layout_width="0.0dp"。

我的理解:当设置了比重属性后,在这个方向上的长度就不确定了,不需要再去适配任何属性了,设置了也白设!因为控件都是绘制到屏幕上的,它会根据布局文件初始化控件在屏幕上的显示,所以设置0dip就相当于初始化时不需要绘制了!

 

http://hi.baidu.com/h3g2010

分享到:
评论

相关推荐

    A_project_demonstrating_use_of_Python_for_DeepStre_dee

    A_project_demonstrating_use_of_Python_for_DeepStre_deepstream_python_apps

    未加载出真正数据时的显示界面LoaderViewLibrary.zip

     android:layout_width="match_parent"  android:layout_height="wrap_content" />在布局文件中定义ImageView的加载页面  android:layout_width="100dp"  android:layout_height="100dp" />用width_weight定义...

    Demonstration_of_the_use_of_TensorRT_an

    Demonstration_of_the_use_of_TensorRT_and_TRITON_healthcare-on-tap-TRT-TRITON-demo

    One-stop_system_for_shared_use_of_AI_within_teams__ChatGPT-Adm

    One-stop_system_for_shared_use_of_AI_within_teams__ChatGPT-Admin-Web

    VS错误提示:To disable deprecation, use _CRT_SECURE_NO_WARNINGS.

    Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 解决方案:更改预处理定义 右击项目名,选择Properties 在c/c++下选择Preprocessor 点击...

    cisco_router_performance_field_guide.zip

    requirement is to fill a hole in having a single source of information, a place to learn about all of the common technologies used by network engineers today. To provide an outline for those common ...

    FormEditText文本验证提示

    In your xml import an extra namespace on the root of your layout xmlns:whatever="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content...

    [machine_learning_mastery系列]better_deep_learning

    neural networks have been used in academia and industry for decades now and there are a suite of standard techniques, tips, and configurations that you can use to greatly increase the likelihood of ...

    A design aid for determining width of filter strips.pdf

    Watershed planners need a tool for determining width of filter strips that is accurate enough for developing cost-effective site designs and easy enough to use for making quick determinations on a ...

    android-viewflow

    android:layout_width="fill_parent" app:footerLineHeight="2dp" app:footerTriangleHeight="10dp" app:textColor="#FFFFFFFF" app:selectedColor="#FFFFC445" app:footerColor="#FFFFC445" app:titlePadding=...

    Android代码-ArcPointer

    ArcPointer Simple customized progress bar in the form of an arch ...android:layout_width and android:layout_height should be set "wrap_content". To specify the size of View, use the radius. Documentatio

    AndroidViewHover

    android:layout_width="match_parent"/> Note: BlurLayout is entended from RelativeLayout. You can use the RelativeLayout rules to layout your view. Create a hover view, there is no rules to obey. ...

    可以滑动页面的项目

    If the device is greater than the version of android L, you can use the following method instead: SliderUtils.attachUi(this, null); Utils.convertActivityToTranslucent activity) If extends ...

    OOP_EN_V3_0.pdf

    panies are responsible or liable for a misuse of the information contained herein. If you have any suggestions for improvements or amendments or have found errors in this publication, please notify us...

    SSD7 选择题。Multiple-Choice

    The degree of a table is the number of _____ in the table. (a) keys (b) columns (c) rows (d) foreign keys Correct answer is (b) Your score on this question is: 10.00 Feedback: (b) ...

    android仿QQ消息气泡拖动删除

    How to use android:id="@+id/drop" android:layout_width="25dp" android:layout_height="25dp" android:gravity="center_vertical" /> WaterDrop drop = (WaterDrop) convertView.findViewById(R.id....

    安卓简单布局及相机调用

    android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> android:id="@+id/username" android:layout_width="match_parent" android:layout_height=...

    Planning_for_Implementation_of_Riparian_Buffers_in.pdf

    The Feitsui reservoir is a major water supply source for more than five million people in Northern Taiwan. The reservoir water quality has been good, but is threatened by eutrophication due to ...

    MC_SDK_5_4培训资料合集.zip

    STM32 MC SDK 5.x,stm32电机库中文培训资料合集分享,包含的文件名如下: 1_An_overview_of_ST_MC_SDK_5;...5_Actual_use_case_of_ST_MC_SDK_5_x; 6_Motor_parameter_measurement_of_ST_MC_SDK5_x

Global site tag (gtag.js) - Google Analytics