Android问题,中心位图显示怪异
我的应用程序中的图像有问题。 我想有一个标题图像,将采取我的应用程序的所有宽度。 为了做到这一点,我制作了一张非常宽的图片,主要对象在中间, 然后在我的布局中居中显示位图 使用该代码:Android问题,中心位图显示怪异,android,xml,bitmap,Android,Xml,Bitmap,我的应用程序中的图像有问题。 我想有一个标题图像,将采取我的应用程序的所有宽度。 为了做到这一点,我制作了一张非常宽的图片,主要对象在中间, 然后在我的布局中居中显示位图 使用该代码: <bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/header" android:gravity="center_horizontal|bottom" />
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/header"
android:gravity="center_horizontal|bottom" />
布局定义:
<?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"
android:background="#ffffff"
android:layout_gravity="center_horizontal" >
<LinearLayout
android:id="@+id/accueil_layout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#ffffff"
android:layout_gravity="center_horizontal" >
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="150dip"
android:background="@drawable/bitmap_header"
android:layout_weight="1">
<TextView
android:id="@+id/allure"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/txt_allure"
/>
</FrameLayout>
<TextView
android:id="@+id/slogan"
android:text="@string/txt_slogan"
/>
这段代码在第一次执行时运行良好
正如你在这里看到的:
如果我调用另一个意图,然后返回到该意图,它仍然正常显示
但如果我把另一个意图称为同一个活动,
此活动的第二个实例显示得很奇怪
如下:
任何人都知道,我如何解决这个问题?我认为这与FrameLayout下的TextView有关,因为它不会显示在第二张图片上。也许将FrameLayout更改为RelativeLayout或LinearLayout,看看会发生什么