【问题标题】:How can I cut the listview on the mask?如何剪切面具上的列表视图?
【发布时间】:2013-11-04 21:08:18
【问题描述】:

我是 android 开发新手。请帮我。

左图是它当前正在做的,右图是我想要的。红色——ListView,灰色——relativelayout的背景

【问题讨论】:

  • 我觉得他问的比较清楚。也许更多的信息会有所帮助。我猜他想在列表视图的顶部放一个面具。
  • 如果背景是相对布局,你显然无法覆盖位于顶部的列表视图。您将不得不添加另一个涵盖您的列表视图的组件。

标签: android listview mask clip


【解决方案1】:

您需要在其上添加一个组件。这是一个简单的解决方案,提供的拱形图像覆盖了列表的一部分。您需要提供自己的拱形图像。

图片:

代码:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="match_parent"
 android:layout_height="match_parent" >

<ListView
  android:id="@+id/list"
  android:layout_width="match_parent"
  android:layout_height="match_parent"> 
</ListView>

<ImageView
    android:id="@+id/imageView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:scaleType="fitXY"
    android:src="@drawable/arch" />

 </RelativeLayout>

【讨论】:

  • 您必须绘制形状并将其添加到根布局中。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-12-11
  • 1970-01-01
  • 1970-01-01
  • 2010-11-26
  • 1970-01-01
  • 1970-01-01
  • 2014-12-21
相关资源
最近更新 更多