Keyboard Pasition
finding if keyboard is hidden or not?
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
Selection of Back Button
1)First you have to detect the back key in functionality :
here is code:
start changing the ‘Back’ button, behavior, you need to override the onKeyDown()
method and than check if the desired button has been pressed:
//Override the onKeyDown method
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
//replaces the default Back button action
if(keyCode==KeyEvent.KEYCODE_BACK)
{
//do whatever you want the Back button to do
//as an example the Back button is set to start a new Activity named NewActivity
this.startActivity(new Intent(YourActivity.this,NewActivity.class));
}
return true;
}
至少是安伯。
@Override
public void onBackPressed()
{
//do whatever you want the Back button to do
//as an example the Back button is set to start a new Activity named NewActivity
this.startActivity(new Intent(YourActivity.this,NewActivity.class));
return;
}