Java 在android studio中无法显示视图
嗨,我是android studio的新手,我想在视图组中添加一个视图,视图组显示正确,但视图中没有。下面是代码:Java 在android studio中无法显示视图,java,android,android-studio,android-layout,Java,Android,Android Studio,Android Layout,嗨,我是android studio的新手,我想在视图组中添加一个视图,视图组显示正确,但视图中没有。下面是代码: class Bookview extends ViewGroup { public Bookview(Context context,int height) { super(context); height = 732; int heightx = height/2; this.setLayo
class Bookview extends ViewGroup
{
public Bookview(Context context,int height)
{
super(context);
height = 732;
int heightx = height/2;
this.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,height));
this.setBackgroundColor(Color.parseColor("#327dcf"));
//view to add
HorizontalScrollView myview = new HorizontalScrollView(context);
myview.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT,heightx));
myview.setBackgroundColor(Color.parseColor("#dd42f5"));
this.addView(myview);
}
}
}
这是我在布局检查器中得到的,视图已添加但未显示。
有什么问题吗