【发布时间】:2012-01-03 18:23:08
【问题描述】:
我已将图像添加到我的 xml 文件中。这是我正在使用的代码:
<?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="fill_parent"
android:orientation="vertical" >
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/topbar_logo2x"
android:scaleType="fitStart" />
<TabHost
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<View
android:layout_width="fill_parent"
android:layout_height="0.5dip"
android:background="#000" />
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dip"
android:layout_marginRight="0dip" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
</TabHost>
</LinearLayout>
我希望我的 TabHost 正好位于我的图像之上。当我在 StackOverflow 中检查了一些答案时,我得到了一个说明要使用的答案
android:scaleType="fitStart"
我想在同一个 ImageView 上同时使用 android:scaleType="fitStart" 和 android:scaleType="fitEnd",这是不可能的,因为 Sndroid 将只允许 scaleType 的一个声明。我将如何通过更改代码来实现相同的目标?还有其他命令可以帮助我吗?
【问题讨论】:
-
所以您希望
TabHost高于ImageView?在xml中将TabHost移到它上面怎么样? -
没有 Jarno,我希望我的图片位于页面顶部(公司徽标),然后是 TabHost
-
没有 Jarno,我希望我的图片位于页面顶部(公司徽标),然后是 TabHost
-
您能否显示您想要的屏幕截图以及它现在的显示方式?您的问题没有包含足够的信息来帮助您...
-
抱歉,Jarno 回复晚了。我已在问题中附上了图片,请仔细阅读。