inflate View - Android User Interface

Android examples for User Interface:View

Description

inflate View

Demo Code


//package com.java2s;

import android.content.Context;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class Main {
    public static View inflateView(int redId, ViewGroup parent) {
        View view = LayoutInflater.from(parent.getContext()).inflate(redId,
                parent, false);//from  w w w  .j  a v a 2  s  .  c o  m
        return view;
    }

    public static View inflateView(int redId, Context context) {
        View view = LayoutInflater.from(context)
                .inflate(redId, null, false);
        return view;
    }
}

Related Tutorials