Dialer应用修改通话界面
2022-06-21 本文已影响0人
DD_Dog
通话界面的功能按钮无法显示,要使它显示出来
1、通过AndroidStudio的Layout Inspector
查看UI结构
image.png
通过该功能可以基本判断出它位于id为incall_ui_container
的incall_pager
里面
2、开始跟踪代码
- incall_screen.xml.xml -->InCallActivity.java --> R.id.main
- transaction.add(R.id.main, inCallScreen.getInCallScreenFragment(), Tags.IN_CALL_SCREEN);
- InCallScreen接口,找到它的实现类-->InCallFragment.java
- layoutInflater.inflate(R.layout.frag_incall_voice, viewGroup, false)); -->找到布局文件 frag_incall_voice.xml
- frag_incall_voice.xml-->R.id.incall_pager 类型为LockableViewPager.java
- R.id.incall_pager被设置pager.setAdapter(adapter); 类型为InCallPagerAdapter.java
- getItem的实现return InCallButtonGridFragment.newInstance(position);
- 打开InCallButtonGridFragment
71 @Override
72 public View onCreateView(
73 LayoutInflater inflater, @Nullable ViewGroup parent, @Nullable Bundle bundle) {
74 View view = inflater.inflate(R.layout.incall_button_grid, parent, false);
75
76 buttons[0] = ((CheckableLabeledButton) view.findViewById(R.id.incall_first_button));
77 buttons[1] = ((CheckableLabeledButton) view.findViewById(R.id.incall_second_button));
78 buttons[2] = ((CheckableLabeledButton) view.findViewById(R.id.incall_third_button));
79 buttons[3] = ((CheckableLabeledButton) view.findViewById(R.id.incall_fourth_button));
80 buttons[4] = ((CheckableLabeledButton) view.findViewById(R.id.incall_fifth_button));
81 buttons[5] = ((CheckableLabeledButton) view.findViewById(R.id.incall_sixth_button));
82
83 return view;
84 }