我有抽象UltraSuperActivity
继承的抽象SuperActivity
继承的MyActivity
。在我调用OnCreate
的哪个包含中,我添加了当前活动的布局SuperActivity
setContentView(R.layout.activity_super);
HorizontalScrollLayout
我在中添加这样的OnCreate
布局MyActivity
:
LinearLayout activity_layout = (LinearLayout)inflater.inflate(R.layout.activity_layout, null);
HorizontalScrollView application_contents = (HorizontalScrollView)findViewById(R.id.application_contents);
HorizontalScrollView.LayoutParams cp = new HorizontalScrollView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
some more code...
application_contents.addView(activity_layout, cp);
Inflater 设置UltraSuperActivity
为静态:
if(inflater == null){
inflater = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
inflater.setFactory(CustomViewFactory.getInstance()); // we add our factory for our views
}
我使用MyButton
的风格是每个按钮的主题。这在activity_super
布局中有效,但在布局中无效activity_layout
,它显示为常见的 Android 按钮。主题设置在AndroidManifest.xml
. 如果我在按钮中添加MyButton
样式,activity_layout
它可以工作,但我不明白为什么它不使用设置主题。