今天接着昨天没看完的bmob短信服务,短信服务的文档介绍不多,但是不好操作,看了大量的CSDN才了解了一点,解除还看了融云中的音视频通话,这个就更难了,只看懂了一点,然后就去B站上看视频教程,这方面敲的代码不多。接着昨天基础界面的制作今天又进一步的敲写,完成一些页面之间的跳转和页面的美化,代码300行
activity_login.xml
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/img_login_bg" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="30dp" android:orientation="vertical"> <EditText android:id="@+id/et_phone" android:layout_width="match_parent" android:layout_height="50dp" android:background="@drawable/login_edit_bg" android:cursorVisible="false" android:hint="@string/text_login_phone" android:inputType="phone" android:padding="5dp" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:gravity="center" android:orientation="horizontal"> <EditText android:id="@+id/et_code" android:layout_width="0dp" android:layout_height="50dp" android:layout_weight="1" android:background="@drawable/login_edit_bg" android:cursorVisible="false" android:hint="@string/text_login_code" android:inputType="number" android:padding="5dp" /> <Button android:textAllCaps="false" android:id="@+id/btn_send_code" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dp" android:background="@drawable/login_btn_bg" android:text="@string/text_login_send" android:textColor="@android:color/white" /> </LinearLayout> <Button android:id="@+id/btn_login" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/login_btn_bg" android:text="@string/text_login_login" android:textColor="@android:color/white" /> <TextView android:id="@+id/tv_test_login" android:layout_marginTop="10dp" android:gravity="right" android:textColor="@color/colorAccent" android:text="测试登录" android:layout_width="match_parent" android:layout_height="wrap_content"/> </LinearLayout> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_marginBottom="20dp" android:gravity="center" android:orientation="horizontal"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/img_login_yes" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:text="@string/text_login_agreement_1" /> <TextView android:id="@+id/tv_user_agreement" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text_login_agreement_2" android:textColor="@color/colorPrimary" /> </LinearLayout> </RelativeLayout>
activity_main.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <FrameLayout android:id="@+id/mMainLayout" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <View android:layout_width="match_parent" android:layout_height="1px" android:background="@color/colorPrimary" /> <LinearLayout android:layout_width="match_parent" android:layout_height="60dp" android:orientation="horizontal"> <LinearLayout android:id="@+id/ll_star" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:id="@+id/iv_star" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/tv_star" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text_main_star" android:textColor="@android:color/white" /> </LinearLayout> <LinearLayout android:id="@+id/ll_square" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:id="@+id/iv_square" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/tv_square" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text_main_square" android:textColor="@android:color/white" /> </LinearLayout> <LinearLayout android:id="@+id/ll_chat" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:id="@+id/iv_chat" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/tv_chat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text_main_chat" android:textColor="@android:color/white" /> </LinearLayout> <LinearLayout android:id="@+id/ll_me" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:id="@+id/iv_me" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/tv_me" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/text_main_me" android:textColor="@android:color/white" /> </LinearLayout> </LinearLayout> </LinearLayout>
activity_index.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@mipmap/ic_launcher" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="@string/app_index_text" android:textSize="22sp" /> </LinearLayout>
activity_chat.xml
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:id="@+id/ll_chat_bg" android:layout_height="match_parent" android:orientation="vertical"> <androidx.recyclerview.widget.RecyclerView android:id="@+id/mChatView" android:layout_margin="5dp" android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:padding="5dp"> <LinearLayout android:gravity="center" android:layout_width="match_parent" android:layout_height="wrap_content"> <EditText android:paddingLeft="10dp" android:id="@+id/et_input_msg" android:layout_weight="1" android:layout_width="0dp" android:layout_height="40dp" android:background="@drawable/chat_edit_bg" /> <Button android:id="@+id/btn_send_msg" android:layout_marginLeft="5dp" android:text="@string/text_login_send" android:background="@drawable/chat_edit_bg" android:layout_width="50dp" android:layout_height="40dp" /> </LinearLayout> <LinearLayout android:layout_width="match_parent" android:layout_height="50dp" android:orientation="horizontal" android:padding="5dp"> <LinearLayout android:id="@+id/ll_voice" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/img_voice" /> </LinearLayout> <LinearLayout android:id="@+id/ll_camera" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/img_camera_chat" /> </LinearLayout> <LinearLayout android:id="@+id/ll_pic" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/img_pic" /> </LinearLayout> <LinearLayout android:id="@+id/ll_location" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_weight="1" android:gravity="center" android:orientation="vertical"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/img_location" /> </LinearLayout> </LinearLayout> </LinearLayout> </LinearLayout>