Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Layout file from library project in android

I have two android projects 1. Main Project 2. Library project. I am referring the Library project in my Main project. I have a fragment in Main Project which should use the layout(.xml) file in library project. How can I achieve this?

like image 791
Rikesh Subedi Avatar asked Jan 20 '15 16:01

Rikesh Subedi


1 Answers

if you want to use it inside your code you can refer to it like this:

com.library_package.R.layout.library_layout

so for example you can inflate layout with:

LayoutInflater.from(context).inflate(com.library_package.R.layout.library_layout, this, true);
like image 83
Bartek Lipinski Avatar answered Nov 14 '22 23:11

Bartek Lipinski