是否可以捕获按钮的释放,就像我们使用onClickListener()和捕获点击一样OnClick()?
我希望在按下按钮时增加按钮的大小,并在释放按钮时将其移回原始大小.任何人都可以帮我怎么做?
任何人都可以解释以下代码的作用吗?
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
View myView = null;
try {
myView = convertView;
if (null == myView) {
LayoutInflater li = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
myView = li.inflate(R.layout.demographic_list_item, null);
}
if (mScan_listItems[position] != null) {
// read the values and attach them.
TextView tv1 = (TextView) myView
.findViewById(R.id.DemoGraphicItem_Text);
tv1.setText(mScan_listItems[position]);
}
} catch (Exception e) {
e.printStackTrace();
}
return myView;
}
}
Run Code Online (Sandbox Code Playgroud) 我对以下场景(C++)有疑问:
说,我有一个if条件
if ( a ? b ? c : d : false)
{
// do something
}
else
{
// do something else
}
Run Code Online (Sandbox Code Playgroud)
这是我对其工作原理的解释:
If a is true, it checks b. Then,
- If b is true, the if loop is reduced to if (c)
- If b is false, the if loop is reduced to if (d)
If a is false, the if loop is reduced to if (false)
Run Code Online (Sandbox Code Playgroud)
我的理解是否正确?
使用这个更好还是多个if/ else支票?