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 に設定します。これが私のローダー クラス リファレンス imageloader で、image を 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);

これは、フィードから高品質の画像を取得する最も簡単な方法です。このコードの全体的なポイントは、デフォルトで Facebook API が小さなバージョンの画像を返すことです。を に置き換える_s.jpg_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 に答える