2013-06-12 34 views

回答

1

1.创建示例项目

enter image description here

2.添加新的模块

enter image description here

enter image description here

enter image description here

3.模块设置

enter image description here

enter image description here

enter image description here

4. APP模块

中删除文件

移动应用程序/ ~~~ /值/ style.xml到公共/ ~~~ /值/ style.xml

enter image description here

enter image description here

编辑1.

<!-- app/~~~/AndroidManifest.xml --> 
<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
    package="kr.susemi99.manifestmergerforandroidstudio" > 

    <application > 
     <activity 
      android:name="kr.susemi99.common.MainActivity"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 

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

</manifest> 

编辑2.

<application 
     android:allowBackup="true" 
     android:icon="@drawable/ic_launcher" 
     android:label="@string/app_name" 
     android:theme="@style/AppTheme"> <!-- add this line --> 
     <activity 
      android:name=".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> 

编辑3.

package kr.susemi99.common; 

import android.os.Bundle; 
import android.support.v7.app.ActionBarActivity; 
import android.view.Menu; 
import android.view.MenuItem; 
import android.widget.Toast; 

public class MainActivity extends ActionBarActivity 
{ 
    @Override 
    protected void onCreate(Bundle savedInstanceState) 
    { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.activity_main); 
    } 


    @Override 
    public boolean onCreateOptionsMenu(Menu menu) 
    { 
     getMenuInflater().inflate(R.menu.menu_main, menu); 
     return true; 
    } 

    @Override 
    public boolean onOptionsItemSelected(MenuItem item) 
    { 
     int id = item.getItemId(); 

     if (id == R.id.action_settings) 
     { 
      Toast.makeText(getApplicationContext(), "test toast", Toast.LENGTH_LONG).show(); 
     } 

     return super.onOptionsItemSelected(item); 
    } 
} 

enter image description here

查看所有http://susemi99.kr/2368