先放效果图
说明:页面中的底部导航栏代码参考https://www.runoob.com/w3cnote/android-tutorial-fragment-demo1.html
聊天列表页 java代码如下
1 package com.example.home;
2
3 import android.content.Intent;
4 import android.os.Bundle;
5 import android.view.LayoutInflater;
6 import android.view.View;
7 import android.view.View.OnClickListener;
8 import android.view.ViewGroup;
9 import android.widget.Toast;
10 import com.example.home.message.SwipeAdapter;
11 import com.example.home.message.SwipeListView;
12 import com.example.home.message.WXMessage;
13 import androidx.fragment.app.Fragment;
14 import java.util.ArrayList;
15 import java.util.List;
16
17 public class MessageFragment extends Fragment implements OnClickListener {
18 SwipeAdapter mAdapter;
19
20
21 @Override
22 public View onCreateView(LayoutInflater inflater, ViewGroup container,
23 Bundle savedInstanceState) {
24 View view = inflater.inflate(R.layout.activity_message, container, false);
25
26
27 SwipeListView mListView = (SwipeListView)view.findViewById(R.id.mListView);
28 final List<WXMessage> data = new ArrayList<WXMessage>();
29 WXMessage msg = null;
30 msg = new WXMessage("家校邦客服", "欢迎登录家校邦!", "早上8:44");
31 msg.setIcon_id(R.drawable.chat1);
32 data.add(msg);
33
34
35 mAdapter = new SwipeAdapter(view.getContext(),data);
36
37 mAdapter.setOnRightItemClickListener(new SwipeAdapter.onRightItemClickListener() {
38
39 @Override
40 public void onRightItemClick(View v, int position) {
41
42 Toast.makeText(v.getContext(), "删除第 " + (position+1)+" 对话记录", Toast.LENGTH_SHORT).show();
43 data.remove(position);
44 mAdapter.notifyDataSetChanged();
45
46 }
47 });
48
49
50 mAdapter.setOnLeftItemClickListener(new SwipeAdapter.onLeftItemClickListener() {
51
52
53 public void onLeftItemClick(View v, int position) {
54
55 Intent intent = new Intent();
56 intent.setAction("abc"); //跳转到聊天窗口,在AndroidManifest.xml文件里需要有相应代码呼应
57 startActivity(intent);
58
59
60 }
61 });
62
63
64
65 mAdapter.setOnTopItemClickListener(new SwipeAdapter.onTopItemClickListener() {
66
67
68 public void onTopItemClick(View v, int position) {
69
70 Intent intent = new Intent();
71 intent.setAction("eee"); //跳转到添加好友窗口
72 startActivity(intent);
73
74
75 }
76 });
77
78
79 mListView.setAdapter(mAdapter);
80
81
82 return view;
83 }
84
85 @Override
86 public void onClick(View view) {
87
88 }
89 }
添加好友窗口 java代码如下
1 package com.example.home.message;
2
3 import android.app.Activity;
4 import android.os.Bundle;
5 import android.view.View;
6 import android.view.View.OnClickListener;
7 import android.view.Window;
8 import android.widget.ImageView;
9
10 import com.example.home.R;
11
12 public class Addfriend extends Activity implements OnClickListener {
13
14 protected void onCreate(Bundle savedInstanceState) {
15 // TODO Auto-generated method stub
16 super.onCreate(savedInstanceState);
17 requestWindowFeature(Window.FEATURE_NO_TITLE);
18 setContentView(R.layout.activity_message_addfriend);
19
20
21 }
22
23
24
25
26 public void onClick(View v) {
27
28 ImageView iv_back3 = (ImageView) findViewById(R.id.iv_back3);
29 iv_back3.setOnClickListener(this);
30
31
32 switch (v.getId()) { //返回到聊天列表
33 case R.id.iv_back3:
34 finish();
35 break;
36 }
37 }
38
39
40 }
Adapter java代码如下
1 package com.example.home.message;
2
3 import android.content.Context;
4 import android.util.Log;
5 import android.view.LayoutInflater;
6 import android.view.View;
7 import android.view.View.OnClickListener;
8 import android.view.ViewGroup;
9 import android.widget.BaseAdapter;
10 import android.widget.ImageButton;
11 import android.widget.ImageView;
12 import android.widget.RelativeLayout;
13 import android.widget.TextView;
14
15 import com.example.home.R;
16
17 import java.util.List;
18
19 public class SwipeAdapter extends BaseAdapter {
20
21 private Context mContext = null;
22 private List<WXMessage> data;
23
24
25 public SwipeAdapter(Context ctx,List<WXMessage> data) {
26 mContext = ctx;
27 this.data = data;
28 }
29
30 @Override
31 public int getCount() {
32 return data.size();
33 }
34
35 @Override
36 public Object getItem(int position) {
37 return null;
38 }
39
40 @Override
41 public long getItemId(int position) {
42 return position;
43 }
44
45 @Override
46 public View getView(final int position, View convertView , final ViewGroup parent) {
47
48 ViewHolder holder;
49 if (convertView == null) {
50 convertView = LayoutInflater.from(mContext).inflate(R.layout.activity_message_chatlist, parent, false);
51 holder = new ViewHolder();
52 holder.item_left = (RelativeLayout)convertView.findViewById(R.id.item_left);
53 holder.item_right = (RelativeLayout)convertView.findViewById(R.id.item_right);
54 holder.addfriend = (ImageButton)convertView.findViewById(R.id.addfriend);
55
56 holder.iv_icon = (ImageView) convertView.findViewById(R.id.iv_icon);
57 holder.tv_title = (TextView)convertView.findViewById(R.id.tv_title);
58 holder.tv_msg = (TextView)convertView.findViewById(R.id.tv_msg);
59 holder.tv_time = (TextView)convertView.findViewById(R.id.tv_time);
60
61 holder.item_right_txt = (TextView)convertView.findViewById(R.id.item_right_txt);
62 convertView.setTag(holder);
63 } else {
64 holder = (ViewHolder)convertView.getTag();
65 }
66
67 Log.i("SwipeAdapter", "getView position="+position);
68
69 WXMessage msg = data.get(position);
70
71 holder.tv_title.setText(msg.getTitle());
72 holder.tv_msg.setText(msg.getMsg());
73 holder.tv_time.setText(msg.getTime());
74
75 holder.iv_icon.setImageResource(msg.getIcon_id());
76
77 holder.item_right.setOnClickListener(new OnClickListener() {
78 @Override
79 public void onClick(View v) {
80 if (mListener != null) {
81 mListener.onRightItemClick(v, position);
82 }
83 }
84 });
85 holder.item_left.setOnClickListener(new OnClickListener() {
86 @Override
87 public void onClick(View v) {
88 if (mlListener != null) {
89
90 v = LayoutInflater.from(mContext).inflate(R.layout.activity_message_chat, parent, false);
91 mlListener.onLeftItemClick(v, position);
92 }
93 }
94
95
96 });
97 holder.addfriend.setOnClickListener(new OnClickListener() {
98 @Override
99 public void onClick(View v) {
100 if (mLListener != null) {
101
102 v = LayoutInflater.from(mContext).inflate(R.layout.activity_message_chat, parent, false);
103 mLListener.onTopItemClick(v, position);
104 }
105 }
106
107
108 });
109 return convertView;
110 }
111
112 static class ViewHolder {
113 public ImageButton addfriend;
114 RelativeLayout item_left;
115 RelativeLayout item_right;
116
117 TextView tv_title;
118 TextView tv_msg;
119 TextView tv_time;
120 ImageView iv_icon;
121
122 TextView item_right_txt;
123 }
124
125
126 private onRightItemClickListener mListener = null;
127
128 public void setOnRightItemClickListener(onRightItemClickListener listener){
129 mListener = listener;
130 }
131
132 public interface onRightItemClickListener {
133 void onRightItemClick(View v, int position);
134 }
135
136
137 private onLeftItemClickListener mlListener = null;
138
139 public void setOnLeftItemClickListener(onLeftItemClickListener listener){
140 mlListener = listener;
141 }
142
143 public interface onLeftItemClickListener {
144 void onLeftItemClick(View v, int position);
145 }
146
147
148 private onTopItemClickListener mLListener = null;
149
150 public void setOnTopItemClickListener(onTopItemClickListener listener){
151 mLListener = listener;
152 }
153
154 public interface onTopItemClickListener {
155 void onTopItemClick(View v, int position);
156 }
157
158
159
160 }
SwipeListView.java代码如下
1 package com.example.home.message;
2
3 import android.content.Context;
4 import android.util.AttributeSet;
5 import android.util.Log;
6 import android.view.MotionEvent;
7 import android.view.View;
8 import android.widget.ListView;
9 import android.widget.RelativeLayout;
10
11 import com.example.home.R;
12
13 public class SwipeListView extends ListView {
14
15 private static final String TAG = SwipeListView.class.getSimpleName();
16
17 private boolean isShown;
18
19 private View mPreItemView;
20
21 private View mCurrentItemView;
22
23 private float mFirstX;
24
25 private float mFirstY;
26
27 private boolean mIsHorizontal;
28
29 public SwipeListView(Context context) {
30 super(context);
31 // TODO Auto-generated constructor stub
32 }
33
34 public SwipeListView(Context context, AttributeSet attrs) {
35 super(context, attrs);
36 // TODO Auto-generated constructor stub
37 }
38
39 public SwipeListView(Context context, AttributeSet attrs, int defStyle) {
40 super(context, attrs, defStyle);
41 // TODO Auto-generated constructor stub
42 }
43
44 @Override
45 public boolean onInterceptTouchEvent(MotionEvent ev) {
46 float lastX = ev.getX();
47 float lastY = ev.getY();
48 switch (ev.getAction()) {
49 case MotionEvent.ACTION_DOWN:
50
51 mIsHorizontal = false;
52
53 mFirstX = lastX;
54 mFirstY = lastY;
55 int motionPosition = pointToPosition((int) mFirstX, (int) mFirstY);
56
57 Log.e(TAG, "onInterceptTouchEvent----->ACTION_DOWN position=" + motionPosition);
58
59 if (motionPosition >= 0) {
60 View currentItemView = getChildAt(motionPosition - getFirstVisiblePosition());
61 mPreItemView = mCurrentItemView;
62 mCurrentItemView = currentItemView;
63 }
64 break;
65
66 case MotionEvent.ACTION_MOVE:
67 float dx = lastX - mFirstX;
68 float dy = lastY - mFirstY;
69
70 if (Math.abs(dx) >= 5 && Math.abs(dy) >= 5) {
71 return true;
72 }
73 break;
74
75 case MotionEvent.ACTION_UP:
76 case MotionEvent.ACTION_CANCEL:
77
78 Log.i(TAG, "onInterceptTouchEvent----->ACTION_UP");
79 if (isShown && mPreItemView != mCurrentItemView) {
80 Log.i(TAG, "1---> hiddenRight");
81 hiddenRight(mPreItemView);
82 }
83 break;
84 }
85
86 return super.onInterceptTouchEvent(ev);
87 }
88
89 @Override
90 public boolean onTouchEvent(MotionEvent ev) {
91 // TODO Auto-generated method stub
92 float lastX = ev.getX();
93 float lastY = ev.getY();
94
95 switch (ev.getAction()) {
96 case MotionEvent.ACTION_DOWN:
97 Log.i(TAG, "---->ACTION_DOWN");
98 break;
99
100 case MotionEvent.ACTION_MOVE:
101 float dx = lastX - mFirstX;
102 float dy = lastY - mFirstY;
103
104 mIsHorizontal = isHorizontalDirectionScroll(dx, dy);
105
106 if (!mIsHorizontal) {
107 break;
108 }
109
110 Log.i(TAG, "onTouchEvent ACTION_MOVE");
111
112 if (mIsHorizontal) {
113 if (isShown && mPreItemView != mCurrentItemView) {
114 Log.i(TAG, "2---> hiddenRight");
115
116 hiddenRight(mPreItemView);
117 }
118 }else {
119 if (isShown) {
120 Log.i(TAG, "3---> hiddenRight");
121
122 hiddenRight(mPreItemView);
123 }
124 }
125 break;
126 case MotionEvent.ACTION_UP:
127 case MotionEvent.ACTION_CANCEL:
128 Log.i(TAG, "============ACTION_UP");
129 if (isShown) {
130 Log.i(TAG, "4---> hiddenRight");
131
132 hiddenRight(mPreItemView);
133 }
134
135 if (mIsHorizontal) {
136 if (mFirstX - lastX > 30) {
137 showRight(mCurrentItemView);
138 } else {
139 Log.i(TAG, "5---> hiddenRight");
140
141 hiddenRight(mCurrentItemView);
142 }
143 return true;
144 }
145 break;
146 }
147
148 return super.onTouchEvent(ev);
149 }
150
151 private void showRight(View rightView) {
152 RelativeLayout rl_right=(RelativeLayout)rightView.findViewById(R.id.item_right);
153 rl_right.setVisibility(View.VISIBLE);
154
155 isShown = true;
156 }
157
158 private void hiddenRight(View rightView) {
159
160 RelativeLayout rl_right=(RelativeLayout)rightView.findViewById(R.id.item_right);
161 rl_right.setVisibility(View.GONE);
162
163 isShown = false;
164 }
165
166
167 private boolean isHorizontalDirectionScroll(float dx, float dy) {
168 boolean mIsHorizontal = true;
169
170 if (Math.abs(dx) > 30 && Math.abs(dx) > 2 * Math.abs(dy)) {
171 mIsHorizontal = true;
172 System.out.println("mIsHorizontal---->" + mIsHorizontal);
173 } else if (Math.abs(dy) > 30 && Math.abs(dy) > 2 * Math.abs(dx)) {
174 mIsHorizontal = false;
175 System.out.println("mIsHorizontal---->" + mIsHorizontal);
176 }
177
178 return mIsHorizontal;
179 }
180
181 }
WXMessage.java代码如下
1 package com.example.home.message;
2
3 public class WXMessage {
4 private int icon_id;
5 private String title;
6 private String msg;
7 private String time;
8
9 public WXMessage(){
10
11 }
12 public WXMessage(String title, String msg, String time) {
13 this.title = title;
14 this.msg = msg;
15 this.time = time;
16 }
17
18
19
20 public int getIcon_id() {
21 return icon_id;
22 }
23 public void setIcon_id(int icon_id) {
24 this.icon_id = icon_id;
25 }
26
27
28
29 public String getTitle() {
30 return title;
31 }
32 public void setTitle(String title) {
33 this.title = title;
34 }
35
36
37
38 public String getMsg() {
39 return msg;
40 }
41 public void setMsg(String msg) {
42 this.msg = msg;
43 }
44
45
46
47 public String getTime() {
48 return time;
49 }
50 public void setTime(String time) {
51 this.time = time;
52 }
53
54 }
以下是xml代码
activity_message.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="match_parent"> 5 6 7 8 <com.example.home.message.SwipeListView 9 android:id="@+id/mListView" 10 android:layout_width="match_parent" 11 android:layout_height="match_parent" 12 android:cacheColorHint="@android:color/transparent"/> 13 14 </RelativeLayout>
activity_message_chatlist.xml
1 <?xml version="1.0" encoding="utf-8"?> 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 android:layout_width="match_parent" 4 android:layout_height="wrap_content"> 5 6 7 <RelativeLayout 8 android:id="@+id/message_top_bar" 9 android:layout_width="match_parent" 10 android:layout_height="40dp" 11 android:background="#87CEFA" 12 > 13 14 <TextView 15 android:id="@+id/message_txt_topbar" 16 android:layout_width="match_parent" 17 android:layout_height="match_parent" 18 android:layout_centerInParent="true" 19 android:gravity="center" 20 android:text="消息" 21 android:textColor="#ffff" 22 android:textSize="18sp" /> 23 24 <ImageButton 25 android:id="@+id/addfriend" 26 android:layout_width="wrap_content" 27 android:layout_height="wrap_content" 28 android:layout_marginRight="10dp" 29 android:layout_alignParentRight="true" 30 android:layout_marginTop="6dp" 31 android:background="@drawable/addf" 32 android:onClick="onClick"/> 33 34 35 </RelativeLayout> 36 37 <RelativeLayout 38 android:id="@+id/item_left" 39 android:layout_width="match_parent" 40 android:layout_height="wrap_content" 41 android:background="#FFFFFF" 42 android:layout_marginTop="40dp" 43 android:paddingBottom="5dp" 44 android:paddingLeft="10dp" 45 android:paddingRight="10dp" 46 android:paddingTop="5dp" > 47 48 <ImageView 49 android:id="@+id/iv_icon" 50 android:layout_width="50dp" 51 android:layout_height="50dp" 52 android:layout_marginRight="5dp" 53 android:src="@drawable/chat1" /> 54 55 <TextView 56 android:id="@+id/tv_title" 57 android:layout_width="wrap_content" 58 android:layout_height="wrap_content" 59 android:layout_toRightOf="@id/iv_icon" 60 android:textColor="@color/black" 61 android:textSize="15sp" /> 62 63 <TextView 64 android:id="@+id/tv_msg" 65 android:layout_width="wrap_content" 66 android:layout_height="wrap_content" 67 android:layout_alignBottom="@id/iv_icon" 68 android:layout_alignLeft="@id/tv_title" 69 android:singleLine="true" 70 android:ellipsize="end" 71 android:textColor="#BEBEBE" /> 72 73 <TextView 74 android:id="@+id/tv_time" 75 android:layout_width="wrap_content" 76 android:layout_height="wrap_content" 77 android:layout_alignParentRight="true" 78 android:layout_alignTop="@id/tv_title" 79 android:textColor="#BEBEBE" /> 80 </RelativeLayout> 81 82 <RelativeLayout 83 android:id="@+id/item_right" 84 android:layout_width="60dp" 85 android:layout_height="30dp" 86 android:layout_alignParentRight="true" 87 android:layout_centerVertical="true" 88 android:layout_marginRight="10dp" 89 android:layout_marginTop="120dp" 90 android:background="#FF0000" 91 android:visibility="gone" > 92 93 <TextView 94 android:id="@+id/item_right_txt" 95 android:layout_width="wrap_content" 96 android:layout_height="wrap_content" 97 android:layout_centerInParent="true" 98 android:gravity="center" 99 android:text="删除" 100 android:textSize="16sp" 101 android:textColor="#FFFFFF" /> 102 </RelativeLayout> 103 104 105 </RelativeLayout>
activity_message_addfriend.xml
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="match_parent" 5 android:orientation="vertical" > 6 7 <LinearLayout 8 android:layout_width="match_parent" 9 android:layout_height="40dp" 10 android:background="#87CEFA" 11 android:gravity="center" 12 android:orientation="horizontal" > 13 14 15 <ImageButton 16 android:id="@+id/iv_back3" 17 android:layout_width="wrap_content" 18 android:layout_height="wrap_content" 19 android:layout_marginLeft="5dp" 20 android:background="@drawable/nf" 21 android:onClick="onClick" 22 /> 23 <TextView 24 android:layout_width="0dp" 25 android:layout_height="wrap_content" 26 android:layout_weight="1" 27 android:gravity="center" 28 android:textColor="#ffffff" 29 android:textSize="15sp" 30 android:text="添加朋友"/> 31 32 33 </LinearLayout> 34 35 <LinearLayout 36 android:layout_height="50dp" 37 android:layout_width="match_parent"> 38 39 <AutoCompleteTextView 40 android:id="@+id/edsearch" 41 android:gravity="center" 42 android:layout_width="match_parent" 43 android:layout_height="50dp" 44 android:layout_weight="1" 45 android:hint="学号/手机号" 46 android:completionThreshold="1" 47 android:textSize="20sp" 48 android:inputType="text" 49 android:lines="1" 50 android:background="@drawable/yuanjiao" 51 android:drawableLeft="@drawable/sousuo1" /> 52 53 54 55 </LinearLayout> 56 57 58 <RelativeLayout 59 android:layout_height="320dp" 60 android:layout_width="match_parent" 61 android:layout_marginTop="37dp"> 62 63 <RelativeLayout 64 android:layout_height="60dp" 65 android:layout_width="match_parent" 66 android:layout_marginTop="15dp" 67 android:background="@color/white"> 68 69 <ImageView 70 android:layout_height="54dp" 71 android:layout_width="54dp" 72 android:layout_marginLeft="10dp" 73 android:layout_marginTop="3dp" 74 android:background="@drawable/leida"> 75 76 </ImageView> 77 78 <TextView 79 android:layout_width="100dp" 80 android:layout_height="30dp" 81 android:layout_marginLeft="80dp" 82 android:layout_marginTop="5dp" 83 android:text="雷达加朋友" 84 android:textSize="18dp" 85 android:textColor="@color/black"> 86 87 </TextView> 88 89 <TextView 90 android:layout_width="100dp" 91 android:layout_height="18dp" 92 android:layout_marginLeft="80dp" 93 android:layout_marginTop="35dp" 94 android:text="添加身边的朋友" 95 android:textSize="14dp" 96 android:textColor="#696969"> 97 98 </TextView> 99 100 <ImageView 101 android:layout_height="30dp" 102 android:layout_width="30dp" 103 android:layout_marginRight="15dp" 104 android:layout_alignParentRight="true" 105 android:layout_marginTop="15dp" 106 android:background="@drawable/arrow"> 107 108 </ImageView> 109 110 111 </RelativeLayout> 112 113 114 <RelativeLayout 115 android:layout_height="60dp" 116 android:layout_width="match_parent" 117 android:layout_marginTop="90dp" 118 android:background="@color/white"> 119 120 <ImageView 121 android:layout_height="54dp" 122 android:layout_width="54dp" 123 android:layout_marginLeft="10dp" 124 android:layout_marginTop="3dp" 125 android:background="@drawable/jianqun"> 126 127 </ImageView> 128 129 130 <TextView 131 android:layout_width="100dp" 132 android:layout_height="30dp" 133 android:layout_marginLeft="80dp" 134 android:layout_marginTop="5dp" 135 android:text="面对面建群" 136 android:textSize="18dp" 137 android:textColor="@color/black"> 138 139 </TextView> 140 141 <TextView 142 android:layout_width="200dp" 143 android:layout_height="18dp" 144 android:layout_marginLeft="80dp" 145 android:layout_marginTop="35dp" 146 android:text="与身边的朋友进入同一个群聊" 147 android:textSize="14dp" 148 android:textColor="#696969"> 149 150 </TextView> 151 152 <ImageView 153 android:layout_height="30dp" 154 android:layout_width="30dp" 155 android:layout_marginRight="15dp" 156 android:layout_alignParentRight="true" 157 android:layout_marginTop="15dp" 158 android:background="@drawable/arrow"> 159 160 </ImageView> 161 162 </RelativeLayout> 163 164 <RelativeLayout 165 android:layout_height="60dp" 166 android:layout_width="match_parent" 167 android:layout_marginTop="165dp" 168 android:background="@color/white"> 169 170 171 <ImageView 172 android:layout_height="54dp" 173 android:layout_width="54dp" 174 android:layout_marginLeft="10dp" 175 android:layout_marginTop="3dp" 176 android:background="@drawable/lianxi"> 177 178 </ImageView> 179 180 181 <TextView 182 android:layout_width="100dp" 183 android:layout_height="30dp" 184 android:layout_marginLeft="80dp" 185 android:layout_marginTop="5dp" 186 android:text="手机联系人" 187 android:textSize="18dp" 188 android:textColor="@color/black"> 189 190 </TextView> 191 192 <TextView 193 android:layout_width="130dp" 194 android:layout_height="18dp" 195 android:layout_marginLeft="80dp" 196 android:layout_marginTop="35dp" 197 android:text="添加通讯录中的好友" 198 android:textSize="14dp" 199 android:textColor="#696969"> 200 201 </TextView> 202 203 <ImageView 204 android:layout_height="30dp" 205 android:layout_width="30dp" 206 android:layout_marginRight="15dp" 207 android:layout_alignParentRight="true" 208 android:layout_marginTop="15dp" 209 android:background="@drawable/arrow"> 210 211 </ImageView> 212 213 214 215 </RelativeLayout> 216 217 <RelativeLayout 218 android:layout_height="60dp" 219 android:layout_width="match_parent" 220 android:layout_marginTop="240dp" 221 android:background="@color/white"> 222 223 <ImageView 224 android:layout_height="54dp" 225 android:layout_width="54dp" 226 android:layout_marginLeft="10dp" 227 android:layout_marginTop="3dp" 228 android:background="@drawable/gong"> 229 230 </ImageView> 231 232 233 <TextView 234 android:layout_width="100dp" 235 android:layout_height="30dp" 236 android:layout_marginLeft="80dp" 237 android:layout_marginTop="5dp" 238 android:text="公众号" 239 android:textSize="18dp" 240 android:textColor="@color/black"> 241 242 </TextView> 243 244 <TextView 245 android:layout_width="150dp" 246 android:layout_height="18dp" 247 android:layout_marginLeft="80dp" 248 android:layout_marginTop="35dp" 249 android:text="获取更多资讯和服务" 250 android:textSize="14dp" 251 android:textColor="#696969"> 252 253 </TextView> 254 255 <ImageView 256 android:layout_height="30dp" 257 android:layout_width="30dp" 258 android:layout_marginRight="15dp" 259 android:layout_alignParentRight="true" 260 android:layout_marginTop="15dp" 261 android:background="@drawable/arrow"> 262 263 </ImageView> 264 265 </RelativeLayout> 266 267 268 </RelativeLayout> 269 270 271 </LinearLayout>
有帮到你的话,点个推荐吧~