पर एक दृश्य पॉप करता है, मैं अपने इनपुट को प्रमाणित करने के लिए टेक्स्टवॉचर का उपयोग कर रहा हूं और मैं चाहता हूं कि मेरी लाल संकेत छवि क्लिक करने योग्य हो, इसलिए मैं नीचे दी गई छवि में दिखाए गए उपयोगकर्ता दृश्य प्रतिक्रिया दे सकता हूं। जब तक मैं अमान्य डेटा दर्ज करता हूं तब दिखाई देने वाली लाल संकेत छवि के साथ अब तक मेरे पास संपादन टेक्स्ट है। अब मैं जानना चाहता हूं कि इस लाल संकेत को क्लिक करने योग्य कैसे बनाया जाए और दिखाए गए पॉप-अप संकेत को प्रकट करें।क्लिकटेक्स्ट में क्लिक करने योग्य यौगिक जो
इस कोड को मैं अब तक है,
public class MainActivity extends Activity implements TextWatcher{
EditText username,email = null;
boolean flag=false;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
username=(EditText) findViewById(R.id.usernametxt);
email=(EditText) findViewById(R.id.emailtxt);
username.addTextChangedListener(this);
username.setOnTouchListener(new View.OnTouchListener(){
public boolean onTouch(View view, MotionEvent motionEvent) {
// your code here...
if(flag)
{
email.setText("Error. . .");
}
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
return false;
}
});
Button loginbtn = (Button) findViewById(R.id.login);
loginbtn.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
//Check Validations
if(username.getText().toString().equalsIgnoreCase(""))
{
username.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.alert, 0);
flag=true;
}
}
});
Button clearbtn = (Button) findViewById(R.id.clear);
clearbtn.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
username.setText("");
email.setText("");
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
public void afterTextChanged(Editable arg0) {
// TODO Auto-generated method stub
}
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
username.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
flag=false;
email.setText("");
}
}
समस्या क्या है? – Akram
@Akki पोस्ट की गई छवि वह है जिसे मैं प्राप्त करना चाहता हूं। मेरे पास अब लाल छवि है जब उपयोगकर्ता अमान्य डेटा में प्रवेश करता है। मैं छवि में दिखाई देने वाला पॉप-अप बनाना चाहता हूं जब उपयोगकर्ता लाल छवि संकेत पर क्लिक करता है। –
मुझे अभी भी यकीन है कि मैं समस्या को समझता हूं। –