Android include 标签注意点

http://www.cnblogs.com/top5/archive/2012/05/07/2486909.html

http://www.eoeandroid.com/thread-273456-1-1.html 

问题引出 :上面两个链接

问题解决:

 <include

        android:id="@id/include_head2"

        android:layout_width="match_parent"

        android:layout_height="60dp"

        layout="@layout/head_view2" />

@ViewInject(R.id.back_button)

private Button back_button;//返回

@ViewInject(R.id.title_textview)

private TextView title_textview;// 标题栏

@ViewInject(R.id.include_head2)

private RelativeLayout include_head2;// 标题栏根布局            注意这里并不是<include>根布局的id,是这个标签的id

title_textview.setText(R.string.title_suggest);

include_head2.setBackgroundResource(R.drawable.color_title_white_trans); //这里就覆盖了<include>根布局的背景


你可能感兴趣的:(Android include 标签注意点)