material design - Android - Applying Code to Tabs (Layouts) in SlidingTabLayouts -


i aspiring android developer not lot of experience , quite new field. of late, have been interested in implementing material design features in first (to-be-published) app, slidingtablayout.

because trying support versions of android api 15, have used android support library , link build slidingtablayout. however, not able figure out how apply sort of java code specific layout tab_1.xml , tab_2.xml can apply onclicklisteners buttons, initialize textviews, etc... exist within layouts.

as far have tested, cannot done in mainactivity because setcontentview mainactivity , not tab layouts, may wrong. once again quite new android development, appreciated!

ps: can add kind of specific code if clarification needed asking.

if understand correctly trying access different kinds of views within layout of tabs. don't have reputation comment on question. if possible please add code above. link gave see code

public class tab2 extends fragment { @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, @nullable bundle savedinstancestate) {     view v = inflater.inflate(r.layout.tab_2,container,false);     return v; } 

}

so access views in tab_2, need access them this. example have button in tab_2 id btn_1.

button button = (button) v.findviewbyid(r.id.btn_1); 

if wrong let me know. i'll out. if find answer helpful, upvote answer.


Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -