5

मैं एक फॉर्म बनाने के लिए materialdatetime पिकर का उपयोग कर रहा हूँ। यदि मैं टेक्स्टव्यू का उपयोग कर रहा हूं, तो यह अच्छा काम कर रहा है, लेकिन मैं इसके लिए एडिटटेक्स्ट का उपयोग करना चाहता हूं, मैं उस छवि को अपलोड कर रहा हूं जिसे आप देख सकते हैं कि अगर मैं एडिटटेक्स्ट का उपयोग कर रहा हूं तो यह कैसा दिखता है और यदि मैं टेक्स्ट व्यू का उपयोग कर रहा हूं तो यह कैसा दिखता है। लेकिन जब संपादन टेक्स्ट का उपयोग करते हैं मुझे डेटपिकर खोलने के लिए दो बार क्लिक करना होगा। पहले क्लिक करने के लिए यह एक संपादन योग्य टेक्स्टबॉक्स की तरह व्यवहार करता है।मैं टेक्स्ट व्यू के बजाय एडिटटेक्स्ट का उपयोग कैसे कर सकता हूं और एक क्लिक में डेट पिकर खोल सकता हूं?

<!-- Adding Payment Method progress --> 
    <ProgressBar 
     android:id="@+id/payment_method_progress" 
     style="?android:attr/progressBarStyleLarge" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_marginBottom="8dp" 
     android:visibility="gone" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/adding_payment_method_heading" 
     android:textSize="@dimen/activity_heading" 
     android:elevation="0dp" 
     android:layout_marginBottom="@dimen/activity_vertical_margin" 
     /> 


    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/adding_payment_method_description" 
     android:textSize="@dimen/activity_description" 
     android:elevation="0dp" 
     android:layout_marginBottom="@dimen/activity_vertical_margin" 
     /> 

    <ScrollView 
     android:id="@+id/adding_payment_method_view" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent"> 

     <LinearLayout 
      android:id="@+id/adding_payment_method_layout" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:orientation="vertical"> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/layout_user_id" 
       > 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/enter_user_name" 
        android:inputType="text" 
        android:maxLines="1" 
        android:singleLine="true" 
        android:id="@+id/user_id" /> 
      </android.support.design.widget.TextInputLayout> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="horizontal"> 

       <TextView 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="left" 
        android:layout_weight="1" 
        android:text="Select Payment Methods" /> 

       <Spinner 
        android:id="@+id/payment_methods" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:layout_gravity="right" 
        android:layout_weight="1" /> 
      </LinearLayout> 
      <LinearLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:orientation="vertical" 
       android:id="@+id/check_chosen" 
       > 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/layout_amount" 
       > 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/amount" 
        android:inputType="numberDecimal" 
        android:maxLines="1" 
        android:singleLine="true" 
        android:id="@+id/amount" /> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/layout_check_number" 
       > 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/check_number" 
        android:inputType="number" 
        android:maxLines="1" 
        android:singleLine="true" 
        android:id="@+id/check_number" /> 
      </android.support.design.widget.TextInputLayout> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/layout_bank_name" 
       > 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/bank_name" 
        android:inputType="text" 
        android:maxLines="1" 
        android:singleLine="true" 
        android:id="@+id/bank_name" /> 
      </android.support.design.widget.TextInputLayout> 


       <android.support.design.widget.TextInputLayout 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/date_of_check" 
        android:layout_weight="1" 
        > 
        <EditText 
         android:layout_width="match_parent" 
         android:layout_height="wrap_content" 
         android:id="@+id/check_date" 
         android:hint="Date" 
         android:inputType="date" /> 
       </android.support.design.widget.TextInputLayout> 
      </LinearLayout> 

      <android.support.design.widget.TextInputLayout 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:id="@+id/layout_payment_info" 
       > 

       <EditText 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:hint="@string/payment_info" 
        android:inputType="text" 
        android:maxLines="1" 
        android:singleLine="true" 
        android:id="@+id/payment_info" /> 
      </android.support.design.widget.TextInputLayout> 

       <TextView 
        android:layout_width="match_parent" 
        android:layout_height="wrap_content" 
        android:id="@+id/payment_date" 
        android:hint="@string/payment_date" 
        android:inputType="date" /> 

      <Button 
       android:id="@+id/add_payment_method_action" 
       style="?android:textAppearanceSmall" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="16dp" 
       android:text="@string/submit" 
       android:onClick="testSubmit" 
       android:textStyle="bold" /> 


    </LinearLayout> 
    </ScrollView> 
</LinearLayout> 

enter image description here

कृपया मुझे पता है, अगर मैं यहाँ जावा कोड पोस्ट करने के लिए की आवश्यकता है।

+0

अपने edittext क्लिक करने योग्य झूठे और इसे करने के लिए onclick सेट श्रोता हैं। यह आपकी मदद करेगा। कोशिश करें और मुझे बताएं –

+0

बस इसे संपादित करें और 'एंड्रॉइड जोड़ें: फोकस करने योग्य इंटचोडोड = "झूठी"' मुझे इसका परीक्षण करने दें और इसके बाद मैं आपके सुझाव का भी उपयोग करूंगा, मुझे जवाब देने के लिए बहुत बहुत धन्यवाद। –

+0

@ रक्षित नवानी 'एंड्रॉइड: फोकस करने योग्य इंटचोडोड =" झूठी "ने मेरी समस्या हल की। –

उत्तर

8

अपने पाठ

+0

ग्रेट, मैंने 'एंड्रॉइड का उपयोग नहीं किया: फोकस करने योग्य =" झूठा "' और आपके उत्तर को संपादित करने से पहले और जोड़ा गया 'एंड्रॉइड: फोकस करने योग्य इंटचोडोड = "झूठा" 'और यह ठीक काम कर रहा है, वैसे भी आपको बहुत धन्यवाद। क्या आप कृपया मुझे बताएं , अगर मेरा एक्सएमएल गलत है, क्योंकि मैं एंड्रॉइड के लिए बहुत नया हूं, तो पता नहीं, अगर मैं इसे सही तरीके से कर रहा हूं। –

+0

id check_chosen के साथ लाइनरलेआउट को छोड़कर बाकी सबकुछ अच्छा दिखता है। आप इसे खत्म कर सकते हैं क्योंकि मूल लेआउट में पहले से लंबवत अभिविन्यास है। –

+0

आपको बहुत धन्यवाद धन्यवाद –

3

आप आपकी आवश्यकता को प्राप्त करने के EditText उपयोग कर सकते हैं संपादन में

android:focusable="false" 
android:focusableInTouchMode="false" 

डाल दिया। सबसे पहले की तरह इस

EditText edTxt; 
edTxt = (TextView) row.findViewById(R.id.acti_edtTxt_date); 

इसके अलावा, आप कोड से यह कर सकते हैं इस

edTxt.setClickable(false); 

तरह से संपादन योग्य छिपाने अब इस edtxt और खुले DatePicker या क्या आप चाहते हैं पर OnClickListener लागू करने के लिए करते हैं।

कृपया ध्यान दें कि setClickable = "false" अपने xml फ़ाइल में जहां हैं अपने EditText को परिभाषित करने

<EditText ... 
    android:clickable="false" 
    android:cursorVisible="false" 
    android:focusable="false" 
    android:focusableInTouchMode="false"> 

1

आप इसे यह focusable false बनाकर हासिल कर सकते हैं।

<EditText ... 
    android:cursorVisible="false" 
    android:focusable="false" 
    android:focusableInTouchMode="false"> 
0

अपने पाठ को संपादित में इस

android:editable="false" 
android:enabled="true" 
+0

क्षमा करें, लेकिन आपके समाधान के लिए मुझे 'त्रुटि: (182) नहीं मिल रहा है पैकेज 'एंड्रॉइड' में विशेषता 'endabled' के लिए संसाधन पहचानकर्ता, किसी भी तरह से आप देख सकते हैं, मैंने अपनी समस्या हल कर ली है और मुझे आशा है कि यह भी आपके लिए उपयोगी होगा। –

+0

ओह ... क्षमा करें मेरी गलती ..असल में यह com.wrapp.floatlabelededittext.FloatLabeledEditText – PpL

+1

के लिए काम करता है आप अपना उत्तर संपादित कर सकते हैं और जिस स्थिति के लिए यह काम करता है और इस प्रश्न का उत्तर देता है, मैंने आपको वोट नहीं दिया है, चिंता न करें। :) –

0

अपने पाठ संपादन में नीचे लाइनों रखो कोशिश:

android:editable="false" 
android:focusableInTouchMode="false" 
संबंधित मुद्दे