android - 如何在 onDraw 方法中创建和显示 ListView ?

标签 android view ondraw

我是 Android 新手,所以请帮助我。 在 onDraw 方法中我画了很多东西,我想把它们作为背景。当我点击角落时,我想要 ListView (带有 SeekBars、按钮等)以及我之前绘制的所有内容作为背景。当 ListView 滚动时,此背景不必滚动。如何创建和设置这样的 ListView ?

我的.xml:

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

<com.project.MyView
    android:id="@+id/main_view"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent" />

</LinearLayout>

最佳答案

将您的自定义 View 作为整个屏幕的背景。您可以通过将 Root View 设为您的自定义 View 来做到这一点。然后计算对角的触摸并使您的 subview 即 ListView 可见。

关于android - 如何在 onDraw 方法中创建和显示 ListView ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10496044/

相关文章:

android - 将值从 ActionBarActivity 发送到 ListFragment

android - 当 adb 通过 tcpip 连接时重新启动设备

c# - 如何将模型的通用属性类型传递给 MVC View

数据库设计: a 'code' table that get referenced by other entities

android - Android View 类的 onDraw 方法通过什么 Canvas ?

java - Android:使用 postInvalidate() 还是直接调用 onDraw?

android - 如何在运行时在屏幕底部显示按钮?

android - 更改标题后应用程序从 Google Play 中消失

javascript - Django/Javascript 交互中 POST 无响应

android - 如何在opengl android上暂停onDrawFrame