视图上的ImageView不';不要出现在Android上
视图上的ImageView在Android上不显示 我有非常简单的代码,只在视图上设置了两个Imageview 它在iOS上运行良好 我已确认“视图”显示正确。 (切换被注释掉的背景色。) 从android到iOS的嵌套视图有什么不同吗 in.xml视图上的ImageView不';不要出现在Android上,android,titanium,Android,Titanium,视图上的ImageView在Android上不显示 我有非常简单的代码,只在视图上设置了两个Imageview 它在iOS上运行良好 我已确认“视图”显示正确。 (切换被注释掉的背景色。) 从android到iOS的嵌套视图有什么不同吗 in.xml <View id="LowMenu"> <ImageView id="LevelLabel" onClick="changeLevel" /> <ImageView id="TweetButton" onClick=
<View id="LowMenu">
<ImageView id="LevelLabel" onClick="changeLevel" />
<ImageView id="TweetButton" onClick="clickTweetButton" />
</View>
在android中,如果你想显示你的
ImageView
,你必须从文件夹drawable
中获取文件,并且要在android中添加id
,你必须调用android:id=“@+id/
而不是android:id=“id
这是android中ImageView
的示例代码:
<ImageView
android:id="@+id/LevelLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginLeft="30dp"
android:src="@drawable/image"/>
在android中应该这样做:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img1" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img2" />
</LinearLayout>
您可以根据需要定制。希望它对Tianium和Android有所帮助,在使用ImageView时,您必须像这样设置图像路径:“/images/yourFolder/otherFolder/image.png”。确保在路径“/images…”之前有第一个斜杠,但是,除了视图中的图像外,其他img文件正确显示,它是Tianium。Tianium是什么意思?哦,我使用Tianium,它是javascript包装器来生成本机代码。所以我想知道这个问题是因为原生行为还是钛的问题。
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img1" />
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/img2" />
</LinearLayout>