我有一个问题,在我的应用程序中的图像。我想有一个标题图像,将采取我的应用程序的所有宽度。为了做到这一点,我创建了一个非常宽的图片,主要物体在中心,然后将位图居中。
使用代码:
<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"
/>
这段代码在第一次执行时运行良好。
你可以在这里看到:http://imagebin.org/index.php?mode=image&id=169619
如果我调用另一个Intent然后回到那个Intent,它仍然会正常显示
但是如果我对同一个活动调用另一个Intent,这个活动的第二个实例显示得很奇怪。
如下:http://imagebin.org/index.php?mode=image&id=169620
有谁知道我该如何解决这个问题吗?
我认为必须在frameayout下与TextView做一些事情,因为它不显示在第二张图片上。也许把framayout改成RelativeLayout或者LinearLayout,看看会发生什么