包括指令不包括所需的内容
问题描述:
嗨,我很新的Android编程,我正在玩include
标签。包括指令不包括所需的内容
我有一个名为companylogo
的布局:命名为homepage
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- Logo Start-->
<ImageView android:src="@drawable/logo2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dip"/>
</LinearLayout>
等布局文件,该文件看起来:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true">
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content" android:background="#ffffff">
<include layout="@layout/companylogo" />
</RelativeLayout>
</ScrollView>
但这并不添加图像到homepage
布局。
我甚至尝试加入android:layoutwidth/height
标签。不知道我犯了什么错误。
在此先感谢。
答
其实,当我们实现XML到我们的代码,那么说明我们必须清理项目有时布局的效果。
并且还尝试将layout_width和layout_height属性添加到包含标记中。
试图清理项目,如果它仍然没有工作,然后
封闭的Eclipse,只是再次打开它,这工作。
的更多信息,请点击此链接:
答
现在有了这个再次尝试:
<include layout="@layout/companylogo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
发表您的'homepage'布局 – vokilam 2013-03-06 07:01:11
如果有投票的名字,+1,:) :) :) – 2013-03-06 07:02:00
@vokilam :我已经更新了这个问题。 – batman 2013-03-06 07:08:45