弹出操作栏上方

时间:2017-03-24 17:49:53

标签: java android android-studio android-actionbar popup

我正在尝试将弹出窗口对齐到操作栏下面,我找不到任何解决方案,我已经看过一些视频而没有,请帮助我,我开始编程,我真的很不错这,这是我的问题的打印屏幕:

https://i.stack.imgur.com/mdHDx.png

这是我的代码:

 if ($count==0) {
        if (preg_match('/^[a-z]{6}+[0-9]{2}+@student.westerdals.no+$/i', $email)) {
            $query = "INSERT INTO members(email, password) VALUES('$email', '$hashed_password')";
            $result = $DBcon->query($query);

     if ($result){
         header("Location: home.php");
      }
     else{ 
          die("Some error");
     }
            die();
        } else {
          die("You must provide a valid student email!");
        }
    } else{
        die("Email already taken!");
    }

XML:

public class MainActivity extends AppCompatActivity {
private WebView webview;
private static final String TAG = "Main";
private ProgressDialog progressBar;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    this.webview = (WebView)findViewById(R.id.webview);

    WebSettings settings = webview.getSettings();
    settings.setJavaScriptEnabled(true);
    webview.addJavascriptInterface(new WebAppInterface(this), "android");
    webview.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
    settings.setDomStorageEnabled(true);

    final AlertDialog alertDialog = new AlertDialog.Builder(this).create();

    progressBar = ProgressDialog.show(MainActivity.this, "Gear Track", "Loading...");

    webview.setWebViewClient(new WebViewClient(){
        public boolean shouldOverrideUrlLoading(WebView view, String url){
            Log.i(TAG, "Processing webview url click...");
            view.loadUrl(url);
            return true;
        }
        public void onPageFinished(WebView view, String url){
            Log.i(TAG, "Finished loading url: " +url);
            if (progressBar.isShowing()){
                progressBar.dismiss();
            }
        }
        public void onReceivedError(WebView view, int errorCode, String description, String failingUrl){
            Log.e(TAG, "Error: " + description);
            Toast.makeText(getApplicationContext(), "Oh no! " + description, Toast.LENGTH_SHORT).show();
            alertDialog.setTitle("Error");
            alertDialog.setMessage(description);
            alertDialog.show();
        }
    });
    webview.loadUrl("https://geartrack.hdn.pt");
}
public class WebAppInterface{
    Context mContext;

    WebAppInterface(Context c){
        mContext = c;
    }

    @JavascriptInterface
    public void showToast(String toast){
        Toast.makeText(mContext, toast, Toast.LENGTH_SHORT).show();
    }
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
    getMenuInflater().inflate(R.menu.mainmenu, menu);
    return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
    switch (item.getItemId()){

        case R.id.action_refresh:
            webview.loadUrl("https://geartrack.hdn.pt");
            return true;

        case R.id.action_about:
            startActivity(new Intent(this, About.class));
            return true;
    }
    return super.onOptionsItemSelected(item);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event){
    if ((keyCode == KeyEvent.KEYCODE_BACK) && webview.canGoBack()){
        webview.goBack();
        return true;
    }
     return super.onKeyDown(keyCode, event);
 }
}

0 个答案:

没有答案
相关问题