简体   繁体   中英

How can I make a child view wider than it's parent view without setting an absolute width?

I'm trying to create a marquee style animated view wherein a very wide linear layout scrolls horizontally within a narrower view. Something like

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

    <LinearLayout ...> <- a very wide layout that animates. 

</LinearLayout>

Problem is I can't figure out how to make the view with the content in it not clip it's width to the size of it's parent without setting an exact layout_width. The animated content view is dynamically created so I don't know the width ahead of time. This is for an appwidget so I'm further constrained by the limitations of RemoteViews.

With RemoteViews you will have to specify a fixed width.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM