0
 <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:paddingLeft="@dimen/quickaction_shadow_horiz"
    android:paddingRight="@dimen/quickaction_shadow_horiz">

    <FrameLayout
        android:id="@+id/header"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="10dip">
        <LinearLayout
            android:id="@+id/quickaction_header"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/quickaction_top_frame"
            android:gravity="center_vertical"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/quickaction_icon"
                android:layout_width="54dip"
                android:layout_height="57dip"
                android:layout_marginLeft="15dip"
                android:layout_marginTop="5dip"
                android:layout_marginBottom="5dip"
                android:scaleType="center" 
                android:visibility="gone" />

            <LinearLayout
                android:id="@+id/quickaction_header_content"
                android:layout_width="0dip"
                android:layout_height="wrap_content"
                android:layout_weight="1"
                android:layout_marginLeft="15dip"
                android:layout_marginRight="15dip"
                android:orientation="vertical"
                android:visibility="gone">
                <TextView
                    android:id="@+id/quickaction_primary_text"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:focusable="true"
                    android:focusableInTouchMode="true"
                    android:singleLine="true"
                    android:ellipsize="marquee"
                    android:textColor="@android:color/primary_text_light"
                    android:textStyle="bold"
                    android:textSize="18dip"
                    android:visibility="gone" />

                <TextView
                    android:id="@+id/quickaction_secondary_text"
                    android:layout_width="fill_parent"
                    android:layout_height="wrap_content"
                    android:textColor="@android:color/secondary_text_light"
                    android:textSize="15dip"
                    android:layout_marginTop="-3dip"
                    android:visibility="gone" />
            </LinearLayout>
        </LinearLayout>
    </FrameLayout>

    <HorizontalScrollView
        android:id="@+id/scroll"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/header"
        android:fadingEdgeLength="0dip"
        android:background="@drawable/quickaction_slider_background"
        android:scrollbars="none">

        <LinearLayout
            android:id="@+id/quickaction"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="4dip"
            android:paddingBottom="4dip"
            android:orientation="horizontal">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/quickaction_slider_grip_left" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@drawable/quickaction_slider_grip_right" />

        </LinearLayout>

    </HorizontalScrollView>

    <FrameLayout
        android:id="@+id/footer"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/scroll"
        android:background="@drawable/quickaction_bottom_frame" />

    <!--  <LinearLayout
        android:id="@+id/footer_disambig"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/scroll"
        android:background="@drawable/quickaction_disambig_bottom_bg"
        android:orientation="vertical"
        android:visibility="gone">

        <ListView
            android:id="@android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="0dip"
            android:layout_weight="1"
            android:background="@color/quickaction_disambig"
            android:divider="@drawable/quickaction_disambig_divider"
            android:cacheColorHint="@null" />

        <CheckBox
            android:id="@+id/checkbox"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginLeft="19dip"
            android:layout_marginRight="19dip"
            android:minHeight="60dip"
            android:textColor="#f000"
            android:textStyle="bold"
            android:text="Remember Choice"
            android:textAppearance="?android:attr/textAppearanceSmallInverse"
            android:button="@drawable/quickaction_disambig_checkbox" />

    </LinearLayout> -->

    <ImageView
        android:id="@+id/arrow_up"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/quickaction_arrow_up" />

    <ImageView
        android:id="@+id/arrow_down"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="-1dip"
        android:layout_below="@id/footer"
        android:src="@drawable/quickaction_arrow_down" />

    <!-- <ImageView
        android:id="@+id/arrow_down_stub"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="-1dip"
        android:layout_below="@id/footer_disambig"
        android:visibility="invisible"
        android:src="@drawable/quickaction_arrow_down" />-->

</RelativeLayout>

您好,我希望我的 Framelayout 的宽度与 Horizo​​ntalscrollview 的宽度相同,如果给定 wrap_content,我不采用 Horizo​​ntalscrollview 的宽度,但采用 fill_parent 我想保留 wrap_content 我该怎么做?

4

1 回答 1

0

在里面添加以下两行<HorizontalScrollView>并尝试一下:

android:layout_alignLeft="@id/header"
android:layout_alignRight="@id/header"

希望这可以帮助。

于 2012-10-26T07:06:31.810 回答