【发布时间】:2012-03-05 07:02:45
【问题描述】:
在我的 android 应用程序中,我使用可扩展列表视图来显示一些文本。这些文本包含 Web URL,因此我想将这些 URL 设置为可点击以转到请求的网页。我已将以下 xml 行添加到我的组布局中在我的可展开列表视图上显示链接。
android:autoLink="web"
它以蓝色显示 URL,但可扩展列表没有扩展,当我点击链接时,它会出现以下异常。我该如何解决这个问题??
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
点击父子视图后会显示其内容。 所以我想做的是设置显示在parent.while中的url可点击,同时展开和折叠可展开列表。
我这样做了,但它也不起作用。
expList.setOnGroupClickListener(new OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v,
int groupPosition, long id) {
Linkify.addLinks(groupNameContent, Linkify.WEB_URLS);
Log.e("setOnGroupClickListener", "tested");
return true;
}
});
当用户单击父级时,父级只是一个文本视图,它会展开并显示包含父级附加详细信息的子级:父级xml:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="5dp" >
<TextView
android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:textSize="11dp"
android:textStyle="normal"
/>
【问题讨论】:
标签: android expandablelistview textview