开发者

Some strange behavior of the UI?

This is the static xml that I have:

<LinearLayout
    android:id="@+id/LinearLayout"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    >

    <RelativeLayout
        android:id="@+id/Header"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1.5"
        android:background="@drawable/header_bg"
        android:padding="0dp"
        >

        <ImageView
            android:id="@+id/hLogo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:src="@drawable/logo"
            />

        <TextView
            android:id="@+id/hActiveCategory"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:text="Today"
            android:textSize="18sp"
            android:textColor="#FFFFFF"
            />

        <Button
            android:id="@+id/hRefreshButton"
            android:layout_width="wrap_content"
            android:la开发者_JAVA技巧yout_height="fill_parent"
            android:drawableRight="@drawable/refresh"
            android:layout_alignParentRight="true"
            android:padding="0dp"
            />

    </RelativeLayout>

</LinearLayout>

What is happening? - when I try to align Button with id=hRefreshButton to the Right of its parent (RelativeLayout with id=Header) there is still space between the button and the right bound of the screen. Why this is happening? Any suggestions? Also I have to emphasize that I'm testing on AVD emulator.


Your button is getting right aligned with respect to parent (Relative Layout) but because of the default background you may see some space left on the right side of the button.

Try setting the background to some image or set background color, you will see for yourself.

Shash

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜