2013-03-06 86 views
1

嗨,我很新的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标签。不知道我犯了什么错误。

在此先感谢。

+0

发表您的'homepage'布局 – vokilam 2013-03-06 07:01:11

+0

如果有投票的名字,+1,:) :) :) – 2013-03-06 07:02:00

+0

@vokilam :我已经更新了这个问题。 – batman 2013-03-06 07:08:45

回答

0

现在有了这个再次尝试:

<include layout="@layout/companylogo" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content"/>