Rikesh Subedi
Rikesh Subedi

Reputation: 1855

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?

Upvotes: 6

Views: 4624

Answers (1)

Bartek Lipinski
Bartek Lipinski

Reputation: 31468

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);

Upvotes: 11

Related Questions