Android 从CustomListViewAdapter中的Imageview获取内容以通过Facebook共享
我创建了一个类似聊天的CustomListview,每个帖子都有一个textview和Imageview,如下所示:Android 从CustomListViewAdapter中的Imageview获取内容以通过Facebook共享,android,listview,imageview,share,Android,Listview,Imageview,Share,我创建了一个类似聊天的CustomListview,每个帖子都有一个textview和Imageview,如下所示: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView andro
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textIsSelectable="true" />
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_launcher" />
</LinearLayout>
如果有人发送图片,它将显示在ImageView中。现在我想实现这个功能,点击Imageview并获取内容,例如在facebook上共享它。因此,基本问题是如何通过单击Imageview获取其内容。仅传递源代码不起作用,因为如果有人发送另一张图片,它会发生变化。您可以使用以下代码从ImageView获取位图:-
Bitmap bmap = Bitmap.createBitmap(imageView.getDrawingCache());
希望这有帮助。您可以使用以下代码从ImageView获取位图:-
Bitmap bmap = Bitmap.createBitmap(imageView.getDrawingCache());
希望这有帮助。您需要将ImageView的内容保存到位图中,然后保存到文件中,然后再共享。如果文件中已有内容,请使用文件url,而不是再次使用。android.content.Intent.ACTION_SEND将显示手机上接收该类型消息的所有选项(在本例中为image/*)
希望这有帮助。您需要将ImageView的内容保存到位图中,然后保存到文件中,然后再共享。如果文件中已有内容,请使用文件url,而不是再次使用。android.content.Intent.ACTION_SEND将显示手机上接收该类型消息的所有选项(在本例中为image/*)
希望这有帮助。Thx这也有帮助,但主要是这有帮助Thx这也有帮助,但主要是这有帮助