【发布时间】:2013-02-20 20:23:40
【问题描述】:
您好,我是 android 编程的新手,我正在玩 include 标签。
我有一个名为 companylogo 的布局:
<?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>
和其他名为 homepage 的布局文件看起来像:
<?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 标签。不知道我在哪里犯了错误。
提前致谢。
【问题讨论】:
-
发布您的
homepage布局 -
如果有名字投票,+1,:) :) :)
-
@vokilam:我已经更新了问题。
-
你测试的是哪个安卓版本?
-
实际上,您的布局适用于 2.2、2.3 和 4.0(已测试)。检查你的drawable。尝试使用此布局制作新的空项目