Closed zhangjinhuang closed 8 years ago
是的。这块适配是根据键盘的高度适配的。
那么就是无解了?还想着可以根据面板的高度来适应呢
我不是很理解,你的意思是,你不想要面板适配键盘的高度吗?如果是这样,你把主动调整面板高度部分代码注释掉就行了。
对啊,因为我觉得面板的高度应该根据它的内容来决定,不然当内容很少的时候,但面板的高度还是跟键盘一样高就会显得空白的地方很多
好的,如果你们业务如此,可以先将你使用的面板,你看下里面有一个 refreshHeight
方法(如 KPSwitchPanelFrameLayout#refreshHeight(int):void
),你把里面的ViewUtil.refreshHeight(this, panelHeight);
注释掉应该就可以了。 我会考虑提供这个配置项的。
get,谢谢你的解答
:)
thx,已使用,另外我想问一下的是解决冲突的关键代码主要是KeyboardUtil.attach()这一块吧,有没有可能把它放到KPSwitchConflictUtil.attach()这里去解决,毕竟KeyboardUtil.attach()添加到了代码中,却没有进行什么操作,容易让人引起困惑,还不如在KPSwitchConflictUtil.attach()中进行判断它是已经有在代码中添加,有的话就不再设置了,这样的话,当用户有需要监听键盘是否显示的时候才重写KeyboardUtil.attach()方法,这只是我个人的一些想法,再次感谢你...
@zhangjinhuang :) 主要原因是 KeyboardUtil.attach()
这个是必须要的,而KpSwitchConflictUtil.attach()
这个是不必要的,用户可以根据自己的需求分开调用 KpswitchConflictUtil
里面的方法而不需要调用 attach()
,留意下两个方法的注解:
/**
* Attach the action of {@code switchPanelKeyboardBtn} and the {@code focusView} to
* non-layout-conflict.
* <p/>
* You do not have to use this method to attach non-layout-conflict, in other words, you can
* attach the action by yourself with invoke methods manually: {@link #showPanel(View)}、
* {@link #showKeyboard(View, View)}、{@link #hidePanelAndKeyboard(View)}, and in the case of don't
* invoke this method to attach, and if your activity with the fullscreen-theme, please ensure your
* panel layout is {@link View#INVISIBLE} before the keyboard is going to show.
*
* @param panelLayout the layout of panel.
* @param switchPanelKeyboardBtn the view will be used to trigger switching between the panel and
* the keyboard.
* @param focusView the view will be focused or lose the focus.
* @param switchClickListener the click listener is used to listening the click event for
* {@code switchPanelKeyboardBtn}.
*/
public static void attach(final View panelLayout,
/** Nullable **/final View switchPanelKeyboardBtn,
/** Nullable **/final View focusView,
/** Nullable **/final SwitchClickListener switchClickListener)
/**
* Recommend invoked by {@link Activity#onCreate(Bundle)}
* For align the height of the keyboard to {@code target} as much as possible.
* For save the refresh the keyboard height to shared-preferences.
*
* @param activity contain the view
* @param target whose height will be align to the keyboard height.
* @param listener the listener to listen in: keyboard is showing or not.
* @see #saveKeyboardHeight(Context, int)
*/
public static void attach(final Activity activity, IPanelHeightTarget target,
/** Nullable **/OnKeyboardShowingListener listener)
KPSwitchPanelLinearLayout的高度都是固定的么, 在布局中设置了wrap_content,但是运行后高度还是固定即使里面没有内容