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

                        android:padding="10dip"
                        android:background="@drawable/greybox"
                        >

                    <ImageView
                            android:id="@+id/profile_pic"
                            android:layout_width="60dp"
                            android:layout_height="60dp"
                            android:layout_marginTop="5dp"
                            android:layout_alignParentTop="true"
                            android:layout_alignParentLeft="true"
                           /> 

                     <RelativeLayout 
                        android:layout_width="wrap_content"
                        android:layout_height="wrap_content"
                        android:orientation="vertical"
                         android:layout_marginLeft="20dp"


                        android:layout_toRightOf="@+id/profile_pic">

                        <TextView
                            android:id="@+id/name"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:text="Kumar"
                            android:textSize="18dp"
                            android:textColor="#4c3f38"
                            android:layout_alignParentLeft="true"


                             />


                        <TextView
                            android:id="@+id/msg"
                            android:layout_width="fill_parent"
                            android:layout_height="wrap_content"
                            android:textSize="15dp" 
                            android:layout_below="@+id/name"
                              android:textColor="#7b7674"

                             />



                        <LinearLayout
                        android:id="@+id/picpostlayout"
                        android:layout_width="fill_parent"
                        android:layout_height="wrap_content"
                        android:layout_gravity="top|center"
                        android:layout_marginTop="5dp"
                        android:layout_below="@+id/msg"
                        android:orientation="vertical" >

                        <ImageView
                            android:id="@+id/picpost"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:adjustViewBounds="true"
                            android:scaleType="fitXY"
                            android:src="@null" />
                    </LinearLayout>

                        <TextView
                            android:id="@+id/comment"
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:textSize="15dp" 
                            android:layout_marginTop="5dp"
                            android:layout_marginRight="5dp"
                            android:layout_below="@+id/picpostlayout"
                            android:layout_alignParentRight="true"

                            android:textColor="#000000"

                             />


                    </RelativeLayout>
                    </RelativeLayout>


    Here is my complete xml.I am using the linearlayout to show the posted picture,but it is still showing very small size.I used two relative layouts, one for complete xml and another for name,message,postpicture.
   Here is also my screenshot to the above given xml file.I am getting the large image but I cant able to show the same size,it is showing very small size.
   I got an post picture from facebook api,I am getting very large image as I used _n.jpg,but when I tried to display using imageview it is showing very small size.

        ][1] 


          [1]: http://i.stack.imgur.com/63nTO.png

 Here is the code of getting posted picture from facebook api.If the post object has picture field then I get that picture and changed that into large image and I added that to my ArrayList pic.

           if(jsonObject.has("picture"))
            {
            String fetchedURL = jsonObject.getString("picture");
            String getFeedPicture = fetchedURL.replaceAll("_s.jpg", "_n.jpg");
            pic.add(getFeedPicture);
            }

然后我将该 ArrayList 发送到我的适配器,在那里我通过发送到 imageloader 类将该图像设置为 imageview。这是我的加载器类参考图像加载器,我正在将图像设置为 imageview。我在我的适配器类中设置它。

imageLoader.DisplayImage(postimage.get(position).replace(" ", "%20"), postimg) ;

4

1 回答 1

2

对您当前的代码进行此修改:

String fetchedURL = JOFeeds.getString("picture");
String getFeedPicture = fetchedURL.replaceAll("_s.jpg", "_n.jpg");
pic.add(getFeedPicture);

这是从您的 Feed 中获得更高质量图片的最简单方法。这段代码的全部意义在于,默认情况下,Facebook API 返回一个小版本的图像。通过替换_s.jpgwith_n.jpg给你一个更大的形象。

我在整个应用程序中都使用了这段代码,它每次都像魅力一样工作。

示例图像

对应的代码是:

<LinearLayout
    android:id="@+id/linlaFeedPicture"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="top|center"
    android:layout_margin="1dp"
    android:gravity="center"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/imgvwFeedPicture"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:adjustViewBounds="true"
        android:scaleType="fitXY"
        android:src="@null" />
</LinearLayout>
于 2012-11-07T06:49:26.807 回答