@@ -149,8 +149,6 @@ private void configPopupWindow() {
149149 mPopupWindow .setHeight (ViewGroup .LayoutParams .WRAP_CONTENT );
150150 mPopupWindow .setBackgroundDrawable (new ColorDrawable (Color .TRANSPARENT ));
151151 mPopupWindow .setClippingEnabled (false );
152- if (mDismissOnInsideTouch || mDismissOnOutsideTouch )
153- mPopupWindow .setTouchInterceptor (mPopupWindowsTouchListener );
154152 }
155153
156154
@@ -223,6 +221,12 @@ private void configContentView() {
223221
224222 mContentView .setPadding ((int ) mPadding , (int ) mPadding , (int ) mPadding , (int ) mPadding );
225223
224+ LinearLayout linearLayout = new LinearLayout (mContext );
225+ linearLayout .setLayoutParams (new ViewGroup .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT ));
226+ linearLayout .setOrientation (mGravity == Gravity .START || mGravity == Gravity .END ? LinearLayout .HORIZONTAL : LinearLayout .VERTICAL );
227+ int layoutPadding = mAnimated ? mAnimationPadding : 0 ;
228+ linearLayout .setPadding (layoutPadding , layoutPadding , layoutPadding , layoutPadding );
229+
226230 if (mShowArrow ) {
227231 mArrowView = new ImageView (mContext );
228232 mArrowView .setImageDrawable (mArrowDrawable );
@@ -232,12 +236,8 @@ private void configContentView() {
232236 } else {
233237 arrowLayoutParams = new LinearLayout .LayoutParams ((int ) mArrowHeight , (int ) mArrowWidth , 0 );
234238 }
239+ arrowLayoutParams .gravity = Gravity .CENTER ;
235240 mArrowView .setLayoutParams (arrowLayoutParams );
236- LinearLayout linearLayout = new LinearLayout (mContext );
237- linearLayout .setLayoutParams (new ViewGroup .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT ));
238- linearLayout .setOrientation (mGravity == Gravity .START || mGravity == Gravity .END ? LinearLayout .HORIZONTAL : LinearLayout .VERTICAL );
239- int padding = mAnimated ? mAnimationPadding : (int ) SimpleTooltipUtils .pxFromDp (4 );
240- linearLayout .setPadding (padding , padding , padding , padding );
241241
242242 if (mGravity == Gravity .TOP || mGravity == Gravity .START ) {
243243 linearLayout .addView (mContentView );
@@ -246,16 +246,18 @@ private void configContentView() {
246246 linearLayout .addView (mArrowView );
247247 linearLayout .addView (mContentView );
248248 }
249-
250- LinearLayout .LayoutParams contentViewParams = new LinearLayout .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT , 0 );
251- contentViewParams .gravity = Gravity .CENTER ;
252- mContentView .setLayoutParams (contentViewParams );
253-
254- mContentLayout = linearLayout ;
255249 } else {
256- mContentLayout = mContentView ;
257- mContentView .setLayoutParams (new ViewGroup .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT ));
250+ linearLayout .addView (mContentView );
258251 }
252+
253+ LinearLayout .LayoutParams contentViewParams = new LinearLayout .LayoutParams (ViewGroup .LayoutParams .WRAP_CONTENT , ViewGroup .LayoutParams .WRAP_CONTENT , 0 );
254+ contentViewParams .gravity = Gravity .CENTER ;
255+ mContentView .setLayoutParams (contentViewParams );
256+
257+ if (mDismissOnInsideTouch || mDismissOnOutsideTouch )
258+ mContentView .setOnTouchListener (mPopupWindowTouchListener );
259+
260+ mContentLayout = linearLayout ;
259261 mContentLayout .setVisibility (View .INVISIBLE );
260262 mPopupWindow .setContentView (mContentLayout );
261263 }
@@ -308,7 +310,7 @@ public void onDismiss() {
308310 mPopupWindow = null ;
309311 }
310312
311- private final View .OnTouchListener mPopupWindowsTouchListener = new View .OnTouchListener () {
313+ private final View .OnTouchListener mPopupWindowTouchListener = new View .OnTouchListener () {
312314
313315 @ Override
314316 public boolean onTouch (View v , MotionEvent event ) {
0 commit comments