android - 对于不断变化的列表,最好的 View /Activity 类型是什么?

标签 android android-layout

我正在寻找需要不断修改的最佳 View 或 Activity 性能。想象一下某种基于“对话”的列表,新元素一直添加到对话中。

光标在这里合适吗? ListActivity 怎么样?

选择重要吗?在性能方面有什么明显的区别吗?我相信您(到现在)已经了解我是 Android 开发的新手。我希望你明白。

最佳答案

我看过内置SMS Android应用程序的源代码,这是布局

<RelativeLayout  xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"  >

    <ListView android:id="@android:id/list"
        style="?android:attr/listViewWhiteStyle"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:drawSelectorOnTop="false"
        android:scrollbarStyle="insideOverlay"
        android:background="@android:color/white"
        android:cacheColorHint="@android:color/white"
        android:fadingEdgeLength="16dip" />

    <TextView android:id="@+id/empty"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="@string/loading_conversations"
        android:textAppearance="?android:attr/textAppearanceMedium" />
</RelativeLayout>

因此,如果您正在制作“对话”应用,则可以安全地使用 ListView 而不会出现性能问题。

关于android - 对于不断变化的列表,最好的 View /Activity 类型是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14655010/

相关文章:

Android:隐藏屏幕顶部边缘的 View

java - LinearLayout 上的 setMinimumHeight() 不起作用(在子类中)

java - 仍然无法创建该表。问题是什么?

android - 如何使用数字用户 ID 在 Android 应用程序中打开 Facebook 个人资料

java - java中httpResponse返回null

具有拖放功能的 Android float 操作按钮

带有渐变的Android形状边框

android - Scrollview 不适用于 Cardview

c# - 在 Xamarin 表单中使用 Effects 的 Android 工具栏中心

javascript - react native 电话号码输入