Compare commits

..

2 Commits

@ -69,10 +69,10 @@ public class MainActivity extends AppCompatActivity {
FragmentManager fm = getSupportFragmentManager(); FragmentManager fm = getSupportFragmentManager();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
if(i==1){ if(i==1){
bundle.putString("jumpPage", "route"); bundle.putString("jumpPage", "trace");
mFragments.get(i).setArguments(bundle); mFragments.get(i).setArguments(bundle);
}else if(i==2){ }else if(i==2){
bundle.putString("jumpPage", "position"); bundle.putString("jumpPage", "location");
mFragments.get(i).setArguments(bundle); mFragments.get(i).setArguments(bundle);
} }
FragmentTransaction trans = fm.beginTransaction(); FragmentTransaction trans = fm.beginTransaction();

@ -3,12 +3,14 @@ package com.example.myapplication.fragment;
import android.os.Bundle; import android.os.Bundle;
import androidx.fragment.app.Fragment; import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import android.util.Log; import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import com.example.myapplication.R;
import com.example.myapplication.databinding.FragmentDeviseBinding; import com.example.myapplication.databinding.FragmentDeviseBinding;
public class DeviseFragment extends Fragment { public class DeviseFragment extends Fragment {
@ -36,6 +38,19 @@ public class DeviseFragment extends Fragment {
Bundle savedInstanceState) { Bundle savedInstanceState) {
// Inflate the layout for this fragment // Inflate the layout for this fragment
binding = FragmentDeviseBinding.inflate(inflater, container, false); binding = FragmentDeviseBinding.inflate(inflater, container, false);
binding.cardView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i("devise", "onClick: 我点击了");
if (jumpPage.equals("location")) {
LocationFragment fragment = new LocationFragment();
getFragmentManager().beginTransaction().replace(R.id.frag_layout, fragment).commit();
} else if (jumpPage.equals("trace")) {
TraceFragment fragment = new TraceFragment();
getFragmentManager().beginTransaction().replace(R.id.frag_layout, fragment).commit();
}
}
});
return binding.getRoot(); return binding.getRoot();
} }
} }

@ -15,22 +15,69 @@
android:padding="@dimen/spacing_16" android:padding="@dimen/spacing_16"
android:text="已授权设备" /> android:text="已授权设备" />
<include layout="@layout/devise_cardview"/> <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
<!-- <com.xuexiang.xui.widget.layout.linkage.LinkageScrollLayout--> xmlns:app="http://schemas.android.com/apk/res-auto"
<!-- android:id="@+id/lsl_container"--> android:id="@+id/card_view"
<!-- android:layout_width="match_parent"--> android:layout_width="match_parent"
<!-- android:layout_height="match_parent"--> android:layout_height="wrap_content"
<!-- android:scrollbars="vertical">--> android:layout_marginStart="@dimen/activity_horizontal_margin"
android:layout_marginTop="10dp"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
<!--&lt;!&ndash; <com.xuexiang.xui.widget.layout.linkage.view.LinkageRecyclerView&ndash;&gt;--> android:layout_marginBottom="6dp"
<!--&lt;!&ndash; android:id="@+id/recyclerView"&ndash;&gt;--> app:cardBackgroundColor="@color/xui_config_color_white"
<!--&lt;!&ndash; android:layout_width="match_parent"&ndash;&gt;--> app:cardCornerRadius="8dp"
<!--&lt;!&ndash; android:layout_height="match_parent"&ndash;&gt;--> app:cardElevation="4dp"
<!--&lt;!&ndash; android:overScrollMode="never"&ndash;&gt;--> app:cardPreventCornerOverlap="true"
<!--&lt;!&ndash; tools:listitem="@layout/devise_cardview" />&ndash;&gt;--> app:contentPaddingBottom="10dp"
app:contentPaddingLeft="@dimen/activity_horizontal_margin"
<!-- </com.xuexiang.xui.widget.layout.linkage.LinkageScrollLayout>--> app:contentPaddingRight="@dimen/activity_horizontal_margin"
app:contentPaddingTop="5dp">
<!-- <include layout="@layout/layout_devise_card_item" />-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<com.xuexiang.xui.widget.imageview.RadiusImageView
android:id="@+id/iv_image"
android:layout_width="100dp"
android:layout_height="80dp"
android:layout_marginStart="8dp"
android:scaleType="centerCrop"
android:src="@drawable/normal_photo"
app:riv_border_width="0dp"
app:riv_corner_radius="5dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="20dp"
android:text="设备-1"
android:textColor="@color/black"
android:textSize="@dimen/mine_ques_top" />
</LinearLayout>
</androidx.cardview.widget.CardView>
<!-- <include layout="@layout/devise_cardview"/>-->
<!-- <com.xuexiang.xui.widget.layout.linkage.LinkageScrollLayout-->
<!-- android:id="@+id/lsl_container"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:scrollbars="vertical">-->
<!--&lt;!&ndash; <com.xuexiang.xui.widget.layout.linkage.view.LinkageRecyclerView&ndash;&gt;-->
<!--&lt;!&ndash; android:id="@+id/recyclerView"&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_width="match_parent"&ndash;&gt;-->
<!--&lt;!&ndash; android:layout_height="match_parent"&ndash;&gt;-->
<!--&lt;!&ndash; android:overScrollMode="never"&ndash;&gt;-->
<!--&lt;!&ndash; tools:listitem="@layout/devise_cardview" />&ndash;&gt;-->
<!-- </com.xuexiang.xui.widget.layout.linkage.LinkageScrollLayout>-->
</LinearLayout> </LinearLayout>

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/bg_gray" android:background="@color/bg_gray"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context=".fragment.LocationFragment"> tools:context=".fragment.LocationFragment"
android:orientation="vertical">
<com.xuexiang.xui.widget.actionbar.TitleBar <com.xuexiang.xui.widget.actionbar.TitleBar
android:id="@+id/titlebar" android:id="@+id/titlebar"
@ -18,6 +19,12 @@
android:background="@drawable/shape_gradient_titlebar_background" android:background="@drawable/shape_gradient_titlebar_background"
android:layout_marginTop="5dp" /> android:layout_marginTop="5dp" />
<ImageView
android:id="@+id/imageView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/map" />
</FrameLayout> </LinearLayout>
Loading…
Cancel
Save