我想在首选项活动的底部添加自定义视图,并且还想实现屏幕中添加的视图的 onClick?当我尝试在首选项屏幕中使用布局充气器添加视图时,它始终位于首选项视图的顶部。但我想在首选项屏幕的底部显示我的视图。
下面是在偏好活动中添加布局的代码片段。
LayoutInflater inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View view = inflater.inflate(R.layout.bottom_preference, null, true);
RelativeLayout.LayoutParams rl=new RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams.MATCH_PARENT,android.widget.RelativeLayout.LayoutParams.MATCH_PARENT);
rl.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
addContentView(view,rl);