2014-03-12 43 views
0

未來在虛擬移動菜單displaying.But它不顯示在我的個人mobile.I一直保持mainactivity.javamain.xmlandroidmainfest.xml文件here.Any答案,請...菜單上沒有頂部右側角球

//mainactivity.java 
public class MainActivity extends Activity{ 
    String username,password;  ResultSet rs =null; 
    boolean temcfag=false; 
    static boolean temqfag=true; 
    public static String tag="Lifecycle activity"; 
    EditText user,pass; 
    AlertDialog.Builder dialog; 
    @Override 
    protected void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 

     dialog=new AlertDialog.Builder(this); 
     dialog.setNeutralButton("OK", null); 


     user=(EditText)findViewById(R.id.editText1); 
     pass=(EditText)findViewById(R.id.editText2); 
      final Button click=(Button)findViewById(R.id.button2);  
      click.setOnClickListener(new View.OnClickListener() {            
         public void onClick(View v) 
          {    
Intent launchactivity= new Intent(MainActivity.this,com.example.desisquarea.LoginActivity.class);        
startActivity(launchactivity);       
          } 
          }); 

    } 
    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
     // Inflate the menu; this adds items to the action bar if it is present. 
     getMenuInflater().inflate(R.menu.main, menu); 
     return true; 
    } 
} 



//menu/main.xml 
<?xml version="1.0" ?> 
<menu xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:id="@+id/login" android:title="SignUP" /> 
<item android:id="@+id/sign" android:title="Login" /> 
<item android:id="@+id/home" android:title="Home" /> 
</menu> 



//androidmainfest.xml 
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="com.example.desisquarea" 
    android:versionCode="1" 
    android:versionName="1.0" > 

    <uses-sdk 
     android:minSdkVersion="8" 
     android:targetSdkVersion="8" /> 

    <uses-permission android:name="android.permission.INTERNET" /> 
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> 

    <application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme" > 
     <activity 
      android:name="com.example.desisquarea.MainActivity" 
      android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 


    </application> 

</manifest> 
+0

您的智能手機在運行什麼版本的Android? – Egor

+0

4.1安卓版本 – PRK449

回答

-1
 LayoutParams lp = dialog.getWindow().getAttributes(); 
     lp.gravity = Gravity.TOP | Gravity.RIGHT; 
    myDialog.getWindow().setAttributes(lp); 
    dialog.show(); 
+0

感謝您的回覆。我應該在哪裏保留此代碼? – PRK449

+0

你在哪裏定義你的警報對話框.. – CoderDecoder

+0

感謝您的答覆。我是Android的初學者學習者。它顯示'myDialog'的錯誤,我是否應該用任何東西來替換'myDialog'的單詞? – PRK449

相關問題