2012-01-08 11 views
8

मेरे पास एक शीर्ष बार के साथ कुछ पाठ संपादित करने की गतिविधि है जो एक स्क्रॉलव्यू के अंदर मल्टीलाइन मोड में एक संपादन टेक्स्ट दृश्य है। नीचे 2 बटन के साथ एक और दृश्य। मैं जो हासिल करना चाहता था वह है जब पाठ को संपादित करना कि नीचे की बार सॉफ्टकीबोर्ड से नीचे होगी। एंड्रॉइड का उपयोग करना आसान है: windowSoftInputMode = "एडजस्टपैन" मेनिफेस्ट में। समस्या यह है कि यदि कई शीर्ष रेखाओं के साथ संपादन काफी बड़ा हो जाता है, तो शीर्षबार को संपादित करते समय यह गायब हो जाता है। यह केवल समायोजन मोड का उपयोग करते समय होता है। लेकिन सबसे खराब और मुझे लगता है कि यह एक बग है, जब कर्सर संपादन दृश्य के अंत में है और डी-पैड जॉयस्टिक का उपयोग करके स्क्रॉल कर रहा है तो सभी लेआउट शीर्ष पर खींचे जाते हैं। http://i.stack.imgur.com/pFadV.pngएंड्रॉइड एडिटटेक्स्ट मल्टीलाइन सॉफ़्टइनपुट मोड समायोजन

बग स्क्रॉल के साथ होता है, ऐसा होता है:

यह EditText पर ध्यान देने के बिना स्क्रीन है

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:background="@color/BackgroundGray" 
    android:gravity="top|center" 
    android:orientation="vertical" 
    android:windowSoftInputMode="adjustPan" > 

    <RelativeLayout 
     android:id="@+id/top_bar" 
     android:layout_width="fill_parent" 
     android:layout_height="45dip" 
     android:layout_alignParentTop="true" 
     android:background="@drawable/top_bar" 
     android:focusable="true" 
     android:focusableInTouchMode="true" > 

     <ImageView 
      android:id="@+id/bar_item_priority" 
      android:layout_width="4dip" 
      android:layout_height="34dip" 
      android:layout_alignParentLeft="true" 
      android:layout_centerVertical="true" 
      android:contentDescription="@string/priority" /> 

     <EditText 
      android:id="@+id/bar_title" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:layout_marginLeft="6dip" 
      android:background="@android:color/transparent" 
      android:fadingEdge="vertical" 
      android:gravity="center_vertical|left" 
      android:hint="@string/default_title" 
      android:inputType="text|textCapSentences" 
      android:paddingLeft="10dip" 
      android:textColor="#f3f3f3" 
      android:textColorHint="#20ffffff" 
      android:textSize="20dip" 
      android:textStyle="bold" > 
     </EditText> 
    </RelativeLayout> 

    <View 
     android:id="@+id/main_top_bar_shadow" 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:layout_below="@+id/top_bar" 
     android:background="@color/TopBarShadow" /> 

    <LinearLayout 
     android:id="@+id/meta_bar" 
     android:layout_width="fill_parent" 
     android:layout_height="25dip" 
     android:layout_below="@+id/main_top_bar_shadow" 
     android:background="#313435" 
     android:descendantFocusability="blocksDescendants" > 

     <TextView 
      android:id="@+id/meta_date_modified" 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:gravity="center_vertical|left" 
      android:paddingLeft="10dip" 
      android:paddingRight="10dip" 
      android:paddingTop="6dip" 
      android:shadowColor="#1d1d1d" 
      android:shadowDx="1" 
      android:shadowDy="1" 
      android:shadowRadius="2" 
      android:text="@string/default_date" 
      android:textColor="#9d9d9d" 
      android:textSize="12dip" 
      android:textStyle="bold" > 
     </TextView> 
    </LinearLayout> 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:layout_above="@+id/bottom_bar" 
     android:layout_below="@+id/meta_bar" 
     android:fillViewport="true" 
     android:scrollbarSize="2dip" 
     android:scrollbarThumbHorizontal="@drawable/scrollbar" 
     android:scrollbarThumbVertical="@drawable/scrollbar" 
     android:scrollbars="vertical" > 

     <view 
      android:id="@+id/note" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@android:color/transparent" 
      android:capitalize="sentences" 
      class="home.greven.notes.NoteEditor$LinedEditText" 
      android:fadingEdge="vertical" 
      android:gravity="top" 
      android:paddingBottom="8dip" 
      android:paddingLeft="11dip" 
      android:paddingRight="11dip" 
      android:paddingTop="8dip" 
      android:textSize="16sp" > 
     </view> 
    </ScrollView> 

    <View 
     android:id="@+id/bottom_bar_shadow" 
     android:layout_width="fill_parent" 
     android:layout_height="1dip" 
     android:layout_above="@+id/bottom_bar" 
     android:background="@color/TopBarShadow" 
     android:focusable="false" 
     android:focusableInTouchMode="false" /> 

    <LinearLayout 
     android:id="@+id/bottom_bar" 
     android:layout_width="fill_parent" 
     android:layout_height="40dip" 
     android:layout_alignParentBottom="true" 
     android:background="@drawable/bottom_buttons_bar" 
     android:descendantFocusability="blocksDescendants" > 

     <Button 
      android:id="@+id/bottom_bar_button_plaintext" 
      style="@style/NoteEditorButtonText" 
      android:layout_width="0.0dip" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:layout_margin="4dip" 
      android:layout_weight="0.5" 
      android:background="@drawable/small_blue_buttonstates" 
      android:text="@string/plain_text" /> 

     <Button 
      android:id="@+id/bottom_bar_button_checklist" 
      style="@style/NoteEditorButtonText" 
      android:layout_width="0.0dip" 
      android:layout_height="wrap_content" 
      android:layout_gravity="center_vertical" 
      android:layout_margin="4dip" 
      android:layout_weight="0.5" 
      android:background="@drawable/small_gray_buttonstates" 
      android:onClick="toChecklist" 
      android:text="@string/checklist" /> 
    </LinearLayout> 

</RelativeLayout> 

मैं हैं: http://i.stack.imgur.com/eS8PP.png

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

उत्तर

2

मुझे नीचे दिए गए बटन के साथ एक ही समस्या है। गुगलिंग के दिनों के बाद मुझे पता चला कि यह

android:isScrollContainer="false" 

स्क्रॉलव्यू में है।

एंड्रॉयड दस्तावेज़ उल्लेख इस

सेट करता है, तो देखने के लिए एक स्क्रॉल कंटेनर रूप में काम करेगा, meaing कि यह अपने समग्र खिड़की हटना ताकि किसी इनपुट विधि के लिए स्थान हो जाएगा आकार दिया जा सकता।

संपादित: यह भी जांच प्रतिक्रिया के लिए इस Answer

+0

धन्यवाद लेकिन यह अभी भी अजीब व्यवहार जब D- पैड के साथ स्क्रॉल करता है। – greven

+0

वास्तव में मैंने डी-पैड में इस कोड का परीक्षण नहीं किया है, लेकिन अन्य डिवाइस समान नहीं दिखाते हैं। –

+0

डी-पैड के साथ स्क्रॉल करते समय केवल एक ही समस्या है और केवल सॉफ्ट-कीबोर्ड दिखा रहा है। इसके अलावा, हाँ, यह समाधान काम करता है, लेकिन बग अभी भी मौजूद है। – greven

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