title: android: inflate views into a layout
body: <p>I add a view which is inflated by LayoutInflater into a layout, then I change the background color of this view,for example, red to blue .After all that, I add a new view , inflated with the same xml file, into the same layout,but i got a view with the background  color blue, not the original color red.
  Here is the test code：</p>
  
  <pre><code>public class InflateActivity extends Activity{
  
  
      private LinearLayout mContainer;
      private View view;
  
      @Override
      protected void onCreate(Bundle saveInstanceState) {
          super.onCreate(saveInstanceState);
          setContentView(R.layout.inflate_test);
          mContainer = (LinearLayout)findViewById(R.id.inflate_container);
          findViewById(R.id.add).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  view = LayoutInflater.from(InflateActivity.this).inflate(R.layout.expanded_record,mContainer,false);
                  mContainer.addView(view,2);
              }
          });
          findViewById(R.id.change_color).setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  view.setBackgroundColor(Color.BLUE);
  
              }
          });
      }
  } 
  </code></pre>
  
  <p>And I got different id by view.toString().
  I can not figure out why.
  I wonder why I make some changes to view A,and the view B which is inflate with the same xml file that not be changed will be affected by these changes.
  Actually,I've made many changes to the view A, but only setBackgroundColor() will affect view B.
  The root view of the xml file is a FrameLayout.Other layout like LinearLayout,RelativeLayout will not come up the problem</p>