We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
对比两个栈
使用 FragmentActivity或 Activity时 整个布局的层级关系:
FragmentActivity
Activity
View Hierarchy: com.android.internal.policy.PhoneWindow$DecorView{287b762 V.E..... ... 0,0-1080,1920} android.widget.LinearLayout{b8a7d7b V.E..... ... 0,0-1080,1776} android.view.ViewStub{32bf62d G.E..... ... 0,0-0,0 #10203ab android:id/action_mode_bar_stub} android.widget.FrameLayout{4551798 V.E..... ... 0,72-1080,1776 #1020002 android:id/content} cn.dreamtobe.kpswitch.widget.KPSwitchRootLinearLayout{5ea5536 V.E..... ... 0,0-1080,1704 #7f0b0052 app:id/rootView} android.support.v7.widget.RecyclerView{880ec37 VFED.... F.. 0,0-1080,1539 #7f0b0068 app:id/content_ryv} android.widget.LinearLayout{6785a4 VFE..... ... 0,1539-1080,1704 #7f0b0053 app:id/sendMsgLayout} android.widget.ImageView{7a40f0d V.ED.... ... 30,34-126,130 #7f0b0054 app:id/voice_text_switch_iv} android.widget.RelativeLayout{e7e8ec2 V.E..... ... 150,25-900,139} android.widget.EditText{76e14d3 VFED..CL ... 0,0-750,114 #7f0b0055 app:id/send_edt} android.widget.TextView{2695810 G.ED..C. ... 0,0-0,0 #7f0b0056 app:id/send_voice_btn} android.widget.RelativeLayout{c0f8f09 V.E..... ... 900,0-1080,165} android.widget.ImageView{a2ad50e V.ED..C. ... 42,34-138,130 #7f0b0057 app:id/plus_iv} android.widget.TextView{7fb2b2f G.ED..C. ... 0,0-0,0 #7f0b0058 app:id/send_btn} cn.dreamtobe.kpswitch.widget.KPSwitchPanelLinearLayout{273e53c G.E..... ... 0,0-0,0 #7f0b0051 app:id/panel_root} android.view.View{39912c5 V.ED.... ... 0,0-0,0} android.widget.LinearLayout{543341a V.E..... ... 0,0-0,0 #7f0b0059 app:id/panel_content} android.widget.TextView{d994b4b V.ED..C. ... 0,0-0,0 #7f0b005a app:id/send_img_tv} android.widget.TextView{6381928 V.ED.... ... 0,0-0,0} android.view.View{a7d1641 V.ED.... ... 0,1776-1080,1920 #1020030 android:id/navigationBarBackground} android.view.View{57520f3 V.ED.... ... 0,0-1080,72 #102002f android:id/statusBarBackground}
使用 AppCompatActivity时 整个布局的层级关系:
AppCompatActivity
View Hierarchy: com.android.internal.policy.PhoneWindow$DecorView{9b17588 V.E..... ... 0,0-1080,1920} android.widget.LinearLayout{18eab21 V.E..... ... 0,0-1080,1776} android.view.ViewStub{e691b46 G.E..... ... 0,0-0,0 #10203ab android:id/action_mode_bar_stub} android.widget.FrameLayout{7342107 V.E..... ... 0,72-1080,1776} android.support.v7.widget.ActionBarOverlayLayout{5ac6234 V.E..... ... 0,0-1080,1704 #7f0b0040 app:id/decor_content_parent} android.support.v7.widget.ContentFrameLayout{889d85d V.E..... ... 0,168-1080,1704 #1020002 android:id/content} cn.dreamtobe.kpswitch.widget.KPSwitchRootLinearLayout{78ba5d2 V.E..... ... 0,0-1080,1536 #7f0b0052 app:id/rootView} android.support.v7.widget.RecyclerView{567c6a3 VFED.... F.. 0,0-1080,1371 #7f0b0068 app:id/content_ryv} android.widget.LinearLayout{c76da0 VFE..... ... 0,1371-1080,1536 #7f0b0053 app:id/sendMsgLayout} android.support.v7.widget.AppCompatImageView{2109d59 V.ED.... ... 30,34-126,130 #7f0b0054 app:id/voice_text_switch_iv} android.widget.RelativeLayout{cda4d1e V.E..... ... 150,25-900,139} android.support.v7.widget.AppCompatEditText{fa629ff VFED..CL ... 0,0-750,114 #7f0b0055 app:id/send_edt} android.support.v7.widget.AppCompatTextView{4c5c3cc G.ED..C. ... 0,0-0,0 #7f0b0056 app:id/send_voice_btn} android.widget.RelativeLayout{5a4b615 V.E..... ... 900,0-1080,165} android.support.v7.widget.AppCompatImageView{fda1d2a V.ED..C. ... 42,34-138,130 #7f0b0057 app:id/plus_iv} android.support.v7.widget.AppCompatTextView{d3d671b G.ED..C. ... 0,0-0,0 #7f0b0058 app:id/send_btn} cn.dreamtobe.kpswitch.widget.KPSwitchPanelLinearLayout{27150b8 G.E..... ... 0,0-0,0 #7f0b0051 app:id/panel_root} android.view.View{7279e91 V.ED.... ... 0,0-0,0} android.widget.LinearLayout{354e1f6 V.E..... ... 0,0-0,0 #7f0b0059 app:id/panel_content} android.support.v7.widget.AppCompatTextView{24159f7 V.ED..C. ... 0,0-0,0 #7f0b005a app:id/send_img_tv} android.support.v7.widget.AppCompatTextView{b46c064 V.ED.... ... 0,0-0,0} android.support.v7.widget.ActionBarContainer{d1692cd V.ED.... ... 0,0-1080,168 #7f0b0041 app:id/action_bar_container} android.support.v7.widget.Toolbar{ae52782 V.E..... ... 0,0-1080,168 #7f0b0042 app:id/action_bar} android.widget.TextView{6279e93 V.ED.... ... 48,43-468,124} android.support.v7.widget.ActionMenuView{9e17ed0 V.E..... ... 1080,0-1080,168} android.support.v7.widget.ActionBarContextView{e868ec9 G.E..... ... 0,0-0,0 #7f0b0043 app:id/action_context_bar} android.view.View{74239ce V.ED.... ... 0,1776-1080,1920 #1020030 android:id/navigationBarBackground} android.view.View{82390ef V.ED.... ... 0,0-1080,72 #102002f android:id/statusBarBackground}
其实整个项目是根据 AppCompatActivity适配起来的。
而很显然在 Activity或FragmentActivity 的布局中 contentView的 parent 是 android.widget.LinearLayout{b8a7d7b V.E..... ... 0,0-1080,1776} 而这个布局的父布局直接就是 DecorView,并且通过分析,获知 这边这个 contentView的parent的高度会等于 DecorViewHeight - NavigationBarHeight,因此就我们的适配中的键盘高度计算,是依赖这个布局的高度变化的只考虑了 AppCompatActivity 的情况,没有覆盖这个情况,这边需要对这个情况进行覆盖,以防止键盘是否显示计算出错。
contentView
parent
android.widget.LinearLayout{b8a7d7b V.E..... ... 0,0-1080,1776}
DecorView
DecorViewHeight
NavigationBarHeight
The text was updated successfully, but these errors were encountered:
c737e97
No branches or pull requests
对比两个栈
使用
FragmentActivity
或Activity
时 整个布局的层级关系:使用
AppCompatActivity
时 整个布局的层级关系:其实整个项目是根据
AppCompatActivity
适配起来的。而很显然在
Activity
或FragmentActivity
的布局中contentView
的parent
是android.widget.LinearLayout{b8a7d7b V.E..... ... 0,0-1080,1776}
而这个布局的父布局直接就是DecorView
,并且通过分析,获知 这边这个contentView
的parent
的高度会等于DecorViewHeight
-NavigationBarHeight
,因此就我们的适配中的键盘高度计算,是依赖这个布局的高度变化的只考虑了AppCompatActivity
的情况,没有覆盖这个情况,这边需要对这个情况进行覆盖,以防止键盘是否显示计算出错。The text was updated successfully, but these errors were encountered: