gpt4 book ai didi

android - 如何在首选项 Activity 中添加自定义布局?

转载 作者:行者123 更新时间:2023-11-30 03:49:32 25 4
gpt4 key购买 nike

<分区>

Possible Duplicate:
How to add a button to PreferenceScreen

我想在preference activity的底部添加自定义 View ,还想实现屏幕中添加的 View 的onClick?当我尝试在首选项屏幕中使用布局充气器添加 View 时,它始终位于首选项 View 的顶部。但我想在首选项屏幕底部显示我的 View 。

以下是在首选项 Activity 中添加布局的代码 fragment 。

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);

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com