2010-06-19 24 views
5

मैं वर्तमान में अपने पहले एंड्रॉइड एप्लिकेशन पर काम कर रहा हूं। मैं अपने आवेदन के लिए एक टैबड लेआउट का उपयोग कर रहा हूँ। मैंने देव गाइड पर इसके लिए ट्यूटोरियल का पालन किया और एक समस्या में भाग गया। ट्यूटोरियल ने केवल तीन टैब का इस्तेमाल किया, लेकिन मुझे और आवश्यकता है। इस प्रकार, टैब का आकार बदलता है और गुच्छा हो जाता है। मैं उम्मीद कर रहा था कि कोई मुझे बता सकता है कि मैं उन्हें कैसे स्क्रॉल कर सकता हूं, जैसे कि कई टैब का उपयोग करते समय डॉल्फिन ब्राउज़र में। धन्यवाद!एंड्रॉइड: स्क्रॉल करने योग्य टैब

~ हारून

उत्तर

1
इस मामले तो आप शायद न टैब का उपयोग करना चाहते हैं में

। बल्कि, आप स्क्रीन इस

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

     ...buttons go here... 

    </LinearLayout> 
</HorizontalScrollView> 

मुझे लगता है कि यह आप परिणाम आप देख रहे हैं दे देंगे की तरह एक scrollview में लिपटे के शीर्ष पर एक क्षैतिज रेखीय लेआउट के लिए आपके "टैब" के सभी डाल सकते हैं, लेकिन मुझे

+0

scrollview के बजाय HorizontalScrollView (जो स्क्रॉल केवल वर्टिकल) – mtmurdock

+0

धन्यवाद का उपयोग करने के संपादित। मैं इसे इस तरह कार्यान्वित करने का प्रयास करूंगा और आपको बता दूंगा। – ariets

+0

स्पष्ट और सरल .... !!! –

3

मुझे बताएं कि मैं Tabizidget को HotizontalScrollView के साथ लपेटने की अनुशंसा करता हूं। इस तरह आप अभी भी टैब का उपयोग कर सकते हैं।

<HorizontalScrollView 
     android:id="@+id/horizontalScrollView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     > 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      /> 
    </HorizontalScrollView> 

यह ध्यान रखें कि अगर आप कम टैब का उपयोग कर रहे हैं, इस टैब स्क्रीन की पूरी चौड़ाई को भरने के लिए नहीं है कारण होगा महत्वपूर्ण है। मैं वर्तमान में इस मुद्दे के लिए एक समाधान की तलाश में हूं।

12

का उपयोग करना क्या योएल ने कहा, सिर्फ जोड़ें: android:fillViewport="true और android:scrollbars="none"

इस तरह HorizontalScrollView रहे हैं:

<HorizontalScrollView 
     android:id="@+id/horizontalScrollView1" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:fillViewport="true" 
     android:scrollbars="none" > 

     <TabWidget 
      android:id="@android:id/tabs" 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" /> 

    </HorizontalScrollView> 
संबंधित मुद्दे