小编M2G*_*2Gd的帖子

Android可点击布局

我有一个线性布局,我设置为clikable + focus,但问题是点击时没有显示焦点.如何才能显示焦点.

继承我的代码

<LinearLayout
  android:id="@+id/linear_tv_layout"
  android:orientation="horizontal"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:layout_weight="1"
  android:clickable="true"
  android:focusable="true"
  android:paddingBottom="7px">
Run Code Online (Sandbox Code Playgroud)

android click event-handling android-layout

12
推荐指数
2
解决办法
3万
查看次数

比较Java中的字符串

我试图比较两个edittext框的值.我想要的是比较passw1 = passw2.因为我的代码现在比较我输入的两个字符串,因为我无法比较它们.

 final EditText passw1= (EditText) findViewById(R.id.passw1);
 final EditText passw2= (EditText) findViewById(R.id.passw2);
 Button buttoks = (Button) findViewById(R.id.Ok);
      buttoks.setOnClickListener(new OnClickListener() {    

    public void onClick(View v) {       

     if (passw1.toString().equalsIgnoreCase("1234") && passw2.toString().equalsIgnoreCase("1234")){
      Toast.makeText(getApplication(),"Username and password match", Toast.LENGTH_SHORT).show();
      }
    else {
        Toast.makeText(getApplication(),"Username and password doesn't match", Toast.LENGTH_SHORT).show();
      }
     }   }); 
Run Code Online (Sandbox Code Playgroud)

java string android

9
推荐指数
3
解决办法
11万
查看次数

标签 统计

android ×2

android-layout ×1

click ×1

event-handling ×1

java ×1

string ×1