每个activity都显示logo

很变态的一个需求,就和网页一样 在每个页面的固定位置都要显示这个东西,如果一个个布局 或者每次引用布局都可以做到,但是比较麻烦关键是需求不让 真他妈的变态 public class BaseActivity extends Activity {

  
      ImageView image;
   LinearLayout linBase;
       
       public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
          
           super.setContentView(R.layout.base_layout);
         
         image = (ImageView)findViewById(R.id.ImageView01);
          image.setImageResource(R.drawable.header);
         
         linBase = (LinearLayout)findViewById(R.id.linBase);
     }
     
     @Override
     public void setContentView(int id) {
         LayoutInflater inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
          inflater.inflate(id, linBase);
     }
         
 }

  public class SomeActivity extends BaseActivity {

       
       public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            
           super.setContentView(R.layout.some_layout);
           
         //rest of code
       }
         
 }
 

你可能感兴趣的:(Activity)