diff --git a/Code/LeudaemiaLikeMe/app/src/main/AndroidManifest.xml b/Code/LeudaemiaLikeMe/app/src/main/AndroidManifest.xml
index cd877d1..e8312a5 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/AndroidManifest.xml
+++ b/Code/LeudaemiaLikeMe/app/src/main/AndroidManifest.xml
@@ -9,8 +9,9 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LeudaemiaLikeMe">
-
-
+
+
+
diff --git a/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Adapter/InvitationPageFragmentAdapter.java b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Adapter/InvitationPageFragmentAdapter.java
new file mode 100644
index 0000000..55644c5
--- /dev/null
+++ b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Adapter/InvitationPageFragmentAdapter.java
@@ -0,0 +1,30 @@
+package com.example.leudaemialikeme.Adapter;
+
+import androidx.annotation.NonNull;
+import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.fragment.app.FragmentPagerAdapter;
+
+import com.example.leudaemialikeme.Fragment.InvitationChannelFragment;
+
+public class InvitationPageFragmentAdapter extends FragmentPagerAdapter {
+ private String[] channelList;
+ private FragmentManager fm;
+ public InvitationPageFragmentAdapter(@NonNull FragmentManager fm, String[] channelList) {
+ super(fm);
+ this.channelList = channelList;
+ this.fm = fm;
+ }
+
+ @NonNull
+ @Override
+ public Fragment getItem(int position) {
+ String InvitationCategoryTitle = channelList[position];
+ return InvitationChannelFragment.newInstance(InvitationCategoryTitle);
+ }
+
+ @Override
+ public int getCount() {
+ return channelList.length;
+ }
+}
diff --git a/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/CommunityFragment.java b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/CommunityFragment.java
index 846cc53..414a171 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/CommunityFragment.java
+++ b/Code/LeudaemiaLikeMe/app/src/main/java/com/example/leudaemialikeme/Fragment/CommunityFragment.java
@@ -1,65 +1,107 @@
package com.example.leudaemialikeme.Fragment;
import android.os.Bundle;
+import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.HorizontalScrollView;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
import androidx.fragment.app.Fragment;
+import androidx.fragment.app.FragmentManager;
+import androidx.viewpager.widget.ViewPager;
+import com.example.leudaemialikeme.Adapter.InvitationPageFragmentAdapter;
import com.example.leudaemialikeme.R;
-/**
- * A simple {@link Fragment} subclass.
- * Use the {@link CommunityFragment#newInstance} factory method to
- * create an instance of this fragment.
- */
-public class CommunityFragment extends Fragment {
-
- // TODO: Rename parameter arguments, choose names that match
- // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
- private static final String ARG_PARAM1 = "param1";
- private static final String ARG_PARAM2 = "param2";
-
- // TODO: Rename and change types of parameters
- private String mParam1;
- private String mParam2;
+public class CommunityFragment extends Fragment implements ViewPager.OnPageChangeListener {
+ private static final String ARG_CHANNEL_LIST = "channel_list";
+ private View view=null; // 碎片的布局实例
+ private ViewPager viewPager; //内导航的碎片的容器
+ private RadioGroup rgChannel=null; // 内导航由单选按钮组构成
+ private HorizontalScrollView hvChannel=null; //单选按钮组可滚动动
+ private String[] channelList = {"关注","全部","经验","扫雷","康复","科普","问答"}; //默认的内导航栏目
+ private InvitationPageFragmentAdapter adapter; //viewPager 的适配器
public CommunityFragment() {
// Required empty public constructor
}
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment CommunityFragment.
- */
- // TODO: Rename and change types and number of parameters
- public static CommunityFragment newInstance(String param1, String param2) {
- CommunityFragment fragment = new CommunityFragment();
- Bundle args = new Bundle();
- args.putString(ARG_PARAM1, param1);
- args.putString(ARG_PARAM2, param2);
- fragment.setArguments(args);
- return fragment;
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ if(view==null){
+ view=inflater.inflate(R.layout.fragment_community, container, false);
+ viewPager=(ViewPager)view.findViewById(R.id.vpNewsList);
+ initViewPager(); //设置 ViewPager
+
+ rgChannel=(RadioGroup)view.findViewById(R.id.rgChannel);
+ hvChannel=(HorizontalScrollView)view.findViewById(R.id.hvChannel);
+ initTab(inflater);
+
+ rgChannel.setOnCheckedChangeListener(
+ new RadioGroup.OnCheckedChangeListener() {
+ @Override
+ public void onCheckedChanged(RadioGroup group, int checkedId) {
+ viewPager.setCurrentItem(checkedId);
+ }
+ }
+ );
+ }
+ return view;
}
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (getArguments() != null) {
- mParam1 = getArguments().getString(ARG_PARAM1);
- mParam2 = getArguments().getString(ARG_PARAM2);
+ private void initTab(LayoutInflater inflater) {
+ for(int i=0;i
+
+ -
+
+
-
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
-
+
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/drawable/search_background.xml b/Code/LeudaemiaLikeMe/app/src/main/res/drawable/search_background.xml
new file mode 100644
index 0000000..f814595
--- /dev/null
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/drawable/search_background.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_go_answer.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_go_answer.xml
index 2c2756a..9c700f9 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_go_answer.xml
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_go_answer.xml
@@ -15,14 +15,12 @@
android:padding="20dp"
android:orientation="horizontal">
-
+ android:layout_height="18dp"
+ android:background="@mipmap/img_go_answer_return"
+ android:layout_marginRight="100dp"
+ />
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_send_question.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_send_question.xml
index 0a7e175..77fb769 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_send_question.xml
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/activity_send_question.xml
@@ -53,7 +53,7 @@
android:layout_width="match_parent"
android:layout_height="42dp"
android:ems="10"
- android:maxlength="40"
+ android:maxLength="40"
android:inputType="textPersonName"
android:layout_margin="10dp"
android:hint="请输入你的问题(10-40个字)" />
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_community.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_community.xml
index af6457d..d9c675a 100644
--- a/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_community.xml
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_community.xml
@@ -3,12 +3,92 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
+ android:orientation="vertical"
tools:context=".Fragment.CommunityFragment">
-
-
+ android:orientation="vertical">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_invitation_channel.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_invitation_channel.xml
new file mode 100644
index 0000000..1f97fb2
--- /dev/null
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/fragment_invitation_channel.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/layout/invitation_tab_rb.xml b/Code/LeudaemiaLikeMe/app/src/main/res/layout/invitation_tab_rb.xml
new file mode 100644
index 0000000..10097ec
--- /dev/null
+++ b/Code/LeudaemiaLikeMe/app/src/main/res/layout/invitation_tab_rb.xml
@@ -0,0 +1,13 @@
+
+
+
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_add.png b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_add.png
new file mode 100644
index 0000000..d8e75f9
Binary files /dev/null and b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_add.png differ
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_go_answer_return.png b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_go_answer_return.png
new file mode 100644
index 0000000..c5a2b98
Binary files /dev/null and b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_go_answer_return.png differ
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_search.png b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_search.png
new file mode 100644
index 0000000..02a18c5
Binary files /dev/null and b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-mdpi/img_search.png differ
diff --git a/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-xhdpi/channel_down_narrow.png b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-xhdpi/channel_down_narrow.png
new file mode 100644
index 0000000..c2ce19f
Binary files /dev/null and b/Code/LeudaemiaLikeMe/app/src/main/res/mipmap-xhdpi/channel_down_narrow.png differ