开发者

Android issue with a centered bitmap displaying weirdly

I have an issue with an image in my application. I would like to have a header image that would take all the width of my application. To do that, I created an extremely wide picture with the main object in the center, then center that bitmap in my layout.

Using that code:

<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/header"
    android:gravity="center_horizontal|bottom" />

and that layout definition:

<?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"
         />

that code this is well working at the first execution.

as you can see here : http://imagebin.org/index.php?mode=image&id=169619

if I call an other Intent and then go back to that one, it's still displayed normally.

But if I call another Intent to the same activity, the second instance of this activity is displayed weirdly.

as here : http://imagebin.org/index.php?mode=image&id=169620

As anyone an idea, on how I could resolve this?


I think that has to do something with TextView under FrameLayout, because it is not displayed on second picutre. Maybe change FrameLayout to RelativeLayout or LinearLayout and see what happens.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜