File tree Expand file tree Collapse file tree 6 files changed +102
-31
lines changed
java/com/meis/basemodule/dialog Expand file tree Collapse file tree 6 files changed +102
-31
lines changed Original file line number Diff line number Diff line change
1
+ package com .meis .basemodule .dialog ;
2
+
3
+ import android .graphics .drawable .ColorDrawable ;
4
+ import android .support .v4 .content .ContextCompat ;
5
+ import android .view .Gravity ;
6
+ import android .view .Window ;
7
+ import android .view .WindowManager ;
8
+
9
+ import com .meis .base .mei .dialog .BaseDialog ;
10
+ import com .meis .basemodule .R ;
11
+
12
+ /**
13
+ * desc: 以底部弹出评论提示框 可以解决很多软键盘与滚动界面冲突问题
14
+ * author: ws
15
+ * date: 2018/4/14.
16
+ */
17
+
18
+ public class BottomCommentDialog extends BaseDialog {
19
+
20
+ @ Override
21
+ protected int getLayoutId () {
22
+ return R .layout .comm_bottom_comment ;
23
+ }
24
+
25
+ @ Override
26
+ protected void initView () {
27
+
28
+ }
29
+
30
+ @ Override
31
+ protected void initData () {
32
+
33
+ }
34
+
35
+ @ Override
36
+ public void onStart () {
37
+ super .onStart ();
38
+
39
+ Window window = getDialog ().getWindow ();
40
+ WindowManager .LayoutParams params = window .getAttributes ();
41
+ // 显示在底部
42
+ params .gravity = Gravity .BOTTOM ;
43
+ // 宽度填充满屏
44
+ params .width = WindowManager .LayoutParams .MATCH_PARENT ;
45
+ //显示dialog的时候,就显示软键盘
46
+ params .softInputMode = WindowManager .LayoutParams .SOFT_INPUT_STATE_ALWAYS_VISIBLE ;
47
+ window .setAttributes (params );
48
+
49
+ // 这里用透明颜色替换掉系统自带背景
50
+ int color = ContextCompat .getColor (getActivity (), android .R .color .transparent );
51
+ window .setBackgroundDrawable (new ColorDrawable (color ));
52
+ }
53
+ }
Original file line number Diff line number Diff line change @@ -22,10 +22,14 @@ protected void initData() {
22
22
showDialog (new CreateLiveDialog ());
23
23
}
24
24
25
- public void clickLive (View v ) {
25
+ public void clickLive (View view ) {
26
26
showDialog (new CreateLiveDialog ());
27
27
}
28
28
29
+ public void clickComment (View view ) {
30
+ showDialog (new BottomCommentDialog ());
31
+ }
32
+
29
33
@ Override
30
34
protected int layoutResId () {
31
35
return R .layout .activity_dialog ;
Original file line number Diff line number Diff line change 15
15
android : text =" @string/click_show_dialog"
16
16
android : textAllCaps =" false" />
17
17
18
+ <Button
19
+ android : layout_width =" match_parent"
20
+ android : layout_height =" wrap_content"
21
+ android : layout_marginBottom =" 24dp"
22
+ android : layout_marginLeft =" 24dp"
23
+ android : layout_marginRight =" 24dp"
24
+ android : onClick =" clickComment"
25
+ android : text =" @string/click_show_comment_dialog"
26
+ android : textAllCaps =" false" />
27
+
18
28
</LinearLayout >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" utf-8" ?>
2
+ <LinearLayout xmlns : android =" http://schemas.android.com/apk/res/android"
3
+ android : layout_width =" match_parent"
4
+ android : layout_height =" wrap_content"
5
+ android : layout_gravity =" bottom"
6
+ android : background =" @android:color/white"
7
+ android : orientation =" horizontal"
8
+ android : tag =" input" >
9
+
10
+ <EditText
11
+ android : id =" @+id/et_send"
12
+ android : layout_width =" 0dp"
13
+ android : layout_height =" @dimen/bottombar_height"
14
+ android : layout_marginLeft =" 8dp"
15
+ android : layout_weight =" 1"
16
+ android : background =" @drawable/bg_chat_input"
17
+ android : hint =" @string/hint_im"
18
+ android : singleLine =" true"
19
+ android : textSize =" 14sp" />
20
+
21
+ <TextView
22
+ android : id =" @+id/btn_send"
23
+ android : layout_width =" wrap_content"
24
+ android : layout_height =" wrap_content"
25
+ android : layout_gravity =" center_vertical"
26
+ android : paddingLeft =" 8dp"
27
+ android : paddingRight =" 8dp"
28
+ android : text =" @string/send"
29
+ android : textAllCaps =" false" />
30
+ </LinearLayout >
31
+
Original file line number Diff line number Diff line change 17
17
android : background =" @android:color/white" />
18
18
</LinearLayout >
19
19
20
- <LinearLayout
21
- android : layout_width =" match_parent"
22
- android : layout_height =" wrap_content"
23
- android : layout_gravity =" bottom"
24
- android : background =" @android:color/white"
25
- android : orientation =" horizontal"
26
- android : paddingLeft =" 8dp"
27
- android : tag =" input" >
28
-
29
- <EditText
30
- android : id =" @+id/et_send"
31
- android : layout_width =" 0dp"
32
- android : layout_height =" @dimen/bottombar_height"
33
- android : layout_weight =" 1"
34
- android : background =" @drawable/bg_chat_input"
35
- android : hint =" @string/hint_im"
36
- android : singleLine =" true"
37
- android : textSize =" 14sp" />
38
-
39
- <TextView
40
- android : id =" @+id/btn_send"
41
- android : layout_width =" wrap_content"
42
- android : layout_height =" wrap_content"
43
- android : layout_gravity =" center_vertical"
44
- android : paddingLeft =" 8dp"
45
- android : paddingRight =" 8dp"
46
- android : text =" @string/send"
47
- android : textAllCaps =" false" />
48
- </LinearLayout >
20
+ <include layout =" @layout/comm_bottom_comment" ></include >
49
21
50
22
<ImageView
51
23
android : layout_width =" match_parent"
Original file line number Diff line number Diff line change 56
56
<string name =" favorite" >收藏</string >
57
57
<string name =" more" >更多</string >
58
58
59
- <string name =" click_show_dialog" >拖动的提示框</string >
59
+ <string name =" click_show_dialog" >底部提示框</string >
60
+ <string name =" click_show_comment_dialog" >底部评论提示框</string >
60
61
</resources >
You can’t perform that action at this time.
0 commit comments