android include中的控件調用


項目中經常會有一些布局是重用的,但是如何來更好的利用這些布局中的控件

轉: http://zhidao.baidu.com/link?url=GU93U8Wu31dfp7mKEx52hMJkxjFLCq3WGkvZ8IMrahQT3wgAbC1Y93sKQ36_GQo3V4-Q9KWRHD6RIxMgBYj0zY7YsYNQuGFGjahZsFnz9wq

<include android:id="@+id/view_counter_buttons_1" layout="@layout/view_counter_button_text" 
android:layout_height="fill_parent"  android:layout_width="fill_parent"/>

RelativeLayout lin = (RelativeLayout)findViewById(R.id.view_counter_buttons_1).findViewById(R.id.layout1);

layout1是view_counter_button_text.xml文件里的ID

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM