这个Android Lint意味着什么:“错误的方向?”

栏目: Android · 发布时间: 6年前

内容简介:翻译自:https://stackoverflow.com/questions/15718555/what-does-this-android-lint-mean-wrong-orientation
我在eclipse中运行 Android

lint并收到错误:

Wrong orientation? No orientation specified, and the default is  horizontal, yet this layout has multiple children where at least one  has layout_width=”match_parent”
Issue: Checks that LinearLayouts with multiple children set the  orientation Id: Orientation

这是错误代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="@dimen/cell_height_1_of_3" >

    <ImageView
        android:id="@+id/item_cover"
        android:layout_width="wrap_content"
        android:layout_height="fill_parent"
        android:layout_gravity="left"
        android:layout_marginLeft="8dp"
        android:scaleType="fitCenter"
        android:src="@drawable/doc_item_icon" />

    <ImageView
        android:layout_width="fill_parent"
        android:layout_height="@dimen/cell_height_1_of_3"
        android:background="#0000"
        android:padding="5dp"
        android:scaleType="centerInside"
        android:visibility="gone" />

    <TextView
        android:id="@+id/item_title"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:ellipsize="end"
        android:gravity="center"
        android:maxLines="1"
        android:text="Add new"
        android:textColor="@color/office_color"
        android:textSize="@dimen/textview_small_size" />

</LinearLayout>

这是什么意思?如果我忽略这个lint错误会怎么样?

Android Lint是ADT 16(和 工具 16)中引入的一种新工具,可以扫描Android项目源以查找潜在的错误.

http://developer.android.com/tools/help/lint.html .

您必须指定布局的方向.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:orientation="vertical"   //specify vertical or horizontal depending on your need
    android:layout_height="@dimen/cell_height_1_of_3" >

http://tools.android.com/tips/lint-checks .lint执行的检查清单.

翻译自:https://stackoverflow.com/questions/15718555/what-does-this-android-lint-mean-wrong-orientation


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

写给大家看的算法书

写给大家看的算法书

【日】杉浦 贤 / 绝云 / 电子工业出版社 / 2016-6 / 59.00元

算法这个词对于非计算机从业人士而言,似乎就是晦涩、神秘的代名词。其实,算法在日常生活中随处可见。做饭用的菜谱是一种算法、查字典的方法是一种算法、给期中考试分数排名也用到了算法。事实上,算法可以说是这个信息爆炸的时代所依存的重要基石之一。 《写给大家看的算法书》对于理解信息处理的基础——算法而言,是一本非常优秀的入门读物。作者采用大量生动的类比,配合简洁易懂的配图,深入浅出地讲解算法,极大地拉......一起来看看 《写给大家看的算法书》 这本书的介绍吧!

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具