【问题标题】:How to get overlapping Gallery items?如何获得重叠的画廊项目?
【发布时间】:2011-10-26 20:59:42
【问题描述】:

我有一个画廊,里面有几个项目,我正在尝试将它们定位,以便您可以看到下一个项目的边缘。很像这样:

对我将如何进行定位有任何帮助吗?

【问题讨论】:

    标签: android


    【解决方案1】:

    这有点取决于你想用它走多远。应该可以使用一个简单的 ScrollView 来添加一个自定义视图,该视图包含您链接的图片中的所有组件。

    您的自定义布局如下所示:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="340dp"
        android:layout_height="fill_parent"
        android:orientation="horizontal" >
    
        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_marginRight="24dp"
            android:orientation="vertical" >
    
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="29"
                android:textColor="#ffff0000"
                android:textSize="24dp"
                android:textStyle="bold" />
    
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="of 30"
                android:textSize="14dp"
                android:textStyle="italic" />
        </LinearLayout>
    
        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical" >
    
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="August 24 8:01 AM"
                android:textStyle="italic" />
    
            <TextView
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:text="Bruce Pearl&apos;s Show-Cause Pentalty And What It Means For His Coaching Future"
                android:textStyle="bold" />
        </LinearLayout>
    </LinearLayout>
    

    这看起来像

    除此之外,如果您想做一些事情,比如让它贴合您的自定义视图的边缘,或者类似的事情,那么您可能需要查看 herehere

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-12-03
      • 2011-03-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多