У меня есть пользовательский вид, который называется BarGraph
, и когда я пытаюсь раздуть его, это не будет.Невозможно надуть пользовательский вид
public class BarGraph extends View {
public BarGraph(Context context) {
super(context);
mContext = context;
// inflateView();
}
public BarGraph(Context context, AttributeSet attrs) {
super(context, attrs);
mContext = context;
// inflateView();
}
private void inflateView() {
LayoutInflater inflater = (LayoutInflater) mContext
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//This line is wrong, can't inflate BarGraph
View v = inflater.inflate(R.layout.bar_graph,this, true);
hsv = (HorizontalScrollView) v.findViewById(R.id.hsv_bar_graph);
}
Ошибка:
The method inflate(int, ViewGroup, boolean) in the type LayoutInflater is not applicable for the arguments (int, BarGraph, boolean)
вы должны установить Барграф Просмотреть в своей деятельности – Piyush
вы можете заблокировать макет и добавить к нему пользовательский вид – Raghunandan
К какому классу относятся ваши пользовательские компоненты? – Amith