2012-03-13 27 views
13

जैसे Pinterest मैं एंड्रॉइड के लिए नया हूं, और मैं ग्रिड व्यू के लिए एक तर्क खोज रहा हूं जैसे पिन-रुचि (होमस्क्रीन) ऐप जो आई-फोन के लिए बनाया गया है। एक बड़ा नंबर छवियों से सर्वर आ रहे हैं जिन्हें मुझे पेजिंग प्रभाव के साथ निम्नलिखित रूप में दिखाने की आवश्यकता है i.e स्क्रॉल पर छवियों को लोड कर रहा हूं।कस्टम ग्रिड व्यू

image is here

जवाब दें अगर यह संभव दूसरी तरह के आसपास है। मैं बहुत आभारी रहूंगा।

+0

मैं आईफोन एप्लिकेशन पर लेआउट pinterest उपयोगों के लिए ग्रिड व्यू को अनुकूलित करने के लिए संघर्ष कर रहा हूं। क्या आप कभी भी आईफोन पर पिनसीज़ लेआउट के समान कुछ बनाने के लिए ग्रिड लेआउट या किसी अन्य लेआउट योजना का उपयोग करने में सक्षम थे? – rOrlig

+0

हैलो @ राज कुमार यादव। क्या आप मेरी मदद कर सकते हैं? क्या आपको एंड्रॉइड में एक ही छवि के रूप में आउटपुट मिला? –

उत्तर

3

आप तो मांग अब

Commonsware अंतहीन एडाप्टर सूची दृश्य के लिए पर लोड तो यह होगा समान WS यूआरएल से सभी डेटा को बचाने View.First सूची में स्क्रॉल पर छवि के लोड करना चाहते हैं, तो आप GridView के साथ एकीकृत कर सकते हैं भी

EndLessAdapter

एक और तरीका है एक ViewFlipper में अपने ग्रिड विचारों डाल करने के लिए और फिर एक एनीमेशन के साथ फ्लिप है।

उपयोग setInAnimation() और setOutAnimation() एनिमेशन showNext() और showPrevious() के साथ पृष्ठों की स्थापना की और फ्लिप करने

0

की जांच: Staggered GridView

StaggeredGridView उपयोगकर्ता असमान के साथ एक GridView बनाने की अनुमति देता Pinterest कैसे दिखता है के समान पंक्तियां। अपने OnItemClickListener और OnItemLongClickListener, चयनकर्ता, और निश्चित स्थिति पुनर्स्थापित शामिल है।

3

लेआउट बनाएं तरह पालन

<ScrollView...> 
<LinearLayout.... 
    android:id="@+id/linear1" 
    orientation="horizontal"> 

    <LinearLayout.... 
    android:id="@+id/linear2" 
    android:layout_weight="0.33" 
    orientation="vertical"> 

    <LinearLayout.... 
    android:id="@+id/linear3" 
    android:layout_weight="0.33" 
    orientation="vertical"> 

    <LinearLayout.... 
    android:layout_weight="0.33" 
    orientation="vertical"> 

</LinearLayout> 
</ScrollView> 

अब लेआउट

linear1 = (LinearLayout) findViewById(R.id.linear1); 
linear2 = (LinearLayout) findViewById(R.id.linear2); 
linear3 = (LinearLayout) findViewById(R.id.linear3); 

for(int i=0;i<n;i++) 
{ 
    ImageView iv = new ImageView(this); 
    iv.setImageResource(R.id.icon); 

    int j = count % 3; <---- 
    if(j==0) 
     linear1.addView(iv); 
    else if(j==1) 
     linear2.addView(iv); 
    else 
     linear3.addView(iv); 
} 
0

इस पुराने सवाल यह है कि में गतिशील रूप से आपकी imageView जोड़ने के लिए, लेकिन उन है कि इसी तरह की समस्या है के लिए के रूप में:

लिए सबसे आसान तरीका इस लेआउट शैली को पूरा करना StaggeredGridLayoutManager के साथ RecyclerView का उपयोग करना है, इस तरह:

protected void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.my_activity); 

    View recyclerView = findViewById(R.id.recycle_view); 
    assert recyclerView != null; 
    StaggeredGridLayoutManager gaggeredGridLayoutManager = new  
    StaggeredGridLayoutManager(2, 1); 
     recyclerView.setLayoutManager(gaggeredGridLayoutManager); 
} 

प्रश्न के दूसरे भाग (पेजिंग) के लिए भाग में अपनी छवियां प्राप्त करने के लिए सबसे अच्छा है (उदाहरण के लिए प्रति अनुरोध 50 छवियां) और जब उपयोगकर्ता नीचे स्क्रॉल करता है (अंत में आता है) अधिक लोड होता है।

संबंधित मुद्दे