Android视图不可服务事件
我正在为android编写某种messenger,现在我面临着一个问题:我考虑将消息状态从未读更改为“用户可以看到消息”时的阅读状态。Message是Android视图不可服务事件,android,events,Android,Events,我正在为android编写某种messenger,现在我面临着一个问题:我考虑将消息状态从未读更改为“用户可以看到消息”时的阅读状态。Message是RelativeLayout的子类,消息通过滚动被组织成垂直布局,可能很长,所以我需要可见事件或类似的东西 我找到了方法void View.onDisplayHint(int-hint),但是文档说 应用程序不应依赖此提示,因为无法保证它们将收到提示 有没有关于如何发现用户变化的建议 UPD:布局代码(如果需要) <?xml version=
RelativeLayout
的子类,消息通过滚动被组织成垂直布局,可能很长,所以我需要可见事件或类似的东西
我找到了方法void View.onDisplayHint(int-hint)
,但是文档说
应用程序不应依赖此提示,因为无法保证它们将收到提示
有没有关于如何发现用户变化的建议
UPD:布局代码(如果需要)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:weightSum="1"
android:layout_height="fill_parent" android:orientation="vertical"
android:id="@+id/conversation_main_layout">
<RelativeLayout android:layout_height="wrap_content"
android:id="@+id/relativeLayoutHeader" android:layout_width="fill_parent"
android:background="@drawable/header_background_selector"
android:padding="3px">
<Button style="@style/header_button"
android:layout_alignParentRight="true" android:text="@string/conversation_right_button"
android:id="@+id/buttonCall"></Button>
<Button style="@style/header_button" android:text="@string/conversation_left_button"
android:layout_alignParentLeft="true" android:id="@+id/buttonInfo"></Button>
<TextView android:layout_width="wrap_content" android:text="@string/conversation_header"
android:layout_centerVertical="true" android:layout_centerHorizontal="true"
android:textAppearance="?android:attr/textAppearanceLarge"
android:id="@+id/textViewContactName" android:layout_height="wrap_content"></TextView>
</RelativeLayout>
<ScrollView android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_margin="3dip"
android:scrollbars="none">
<LinearLayout android:id="@+id/linearLayoutDataHolder"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
</LinearLayout>
</ScrollView>
</LinearLayout>
我是否正确理解您的意思?您的根视图是ScrollView
,带有附加的LinearLayout
,垂直方向上有一些RelativeLayout
s(消息)?是的,它是。滚动视图->线性布局(垂直)->相对布局