मैं वास्तव में लगता है कि मुझे समझ में नहीं कर रहा हूँ फिर से उपयोग न बहुत बुरा आप क्या कह रहे हैं, लेकिन अगर आप बस एक लेआउट से देखें का एक उदाहरण को दूर करना चाहते हैं और एक अन्य के साथ आदान-प्रदान कर आप इस तरह एक उपयोगिता वर्ग इस्तेमाल कर सकते हैं:
import android.view.View;
import android.view.ViewGroup;
public class ViewGroupUtils {
public static ViewGroup getParent(View view) {
return (ViewGroup)view.getParent();
}
public static void removeView(View view) {
ViewGroup parent = getParent(view);
if(parent != null) {
parent.removeView(view);
}
}
public static void replaceView(View currentView, View newView) {
ViewGroup parent = getParent(currentView);
if(parent == null) {
return;
}
final int index = parent.indexOfChild(currentView);
removeView(currentView);
removeView(newView);
parent.addView(newView, index);
}
}
फ़ॉलो-अप प्रश्न: आप जब आपका क्या मतलब है 'कह रहे हैं "डुप्लिकेट करने के लिए बहुत बुरा है और पुन: उपयोग नहीं किया जा रहा है"? क्या आप include tag से अवगत हैं?
कुछ कोड पेस्ट करें –
डुप्लिकेट के लिए मेरा बहाना: Google इसे नहीं मिला, भले ही मैं इसे +1 करता हूं। हमम ... –