乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      團(tuán)隊(duì)沖刺--第一階段(二)

       印度阿三17 2020-04-18

      一、前言

        昨天完成了加載頁(yè),星球頁(yè)的設(shè)計(jì),學(xué)習(xí)了Fragment實(shí)現(xiàn)底部導(dǎo)航欄。

        今天將Cardview與傳感器結(jié)合起來(lái),實(shí)現(xiàn)了發(fā)布表可以跟隨手機(jī)晃動(dòng)。學(xué)習(xí)了Fragment的嵌套實(shí)現(xiàn)了我的頁(yè)面上“我的發(fā)帖”與“我的回帖”的切換。遇到的困難:一些控件或者版本之間的沖突,通過(guò)查閱資料,修改包解決問(wèn)題;Fragment沒(méi)有很好的理解,導(dǎo)致在嵌套中出現(xiàn)了困難,通過(guò)查閱資料與重學(xué)Fragment實(shí)現(xiàn)嵌套,UI頁(yè)面方面出現(xiàn)問(wèn)題,不知如何具體下去。

        明天對(duì)登錄注冊(cè)頁(yè)面進(jìn)行美化,以及學(xué)習(xí)頭部標(biāo)題欄的運(yùn)用。

      二、成果展示

      ?

      ?

      ?三、代碼

      SendActivity.java

      ?

      package com.example.myteamapplication.Activity;
      
      import android.hardware.Sensor;
      import android.hardware.SensorEvent;
      import android.hardware.SensorEventListener;
      import android.hardware.SensorManager;
      import android.os.Bundle;
      import android.view.WindowManager;
      import android.widget.FrameLayout;
      
      import androidx.appcompat.app.AppCompatActivity;
      import androidx.cardview.widget.CardView;
      
      import com.example.myteamapplication.R;
      
      
      public class SendActivity extends AppCompatActivity implements SensorEventListener {
      
      
          private SensorManager sensorManager;
          private Sensor defaultSensor;
          private CardView cv;
      
          @Override
          protected void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              //去掉頂部標(biāo)題
              getSupportActionBar().hide();
              //去掉最上面時(shí)間、電量等
              getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN
                      , WindowManager.LayoutParams.FLAG_FULLSCREEN);
              setContentView(R.layout.activity_send);
              initView();
              sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//獲得傳感器管理
              defaultSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);//設(shè)置類型
          }
      
      
          @Override
          protected void onResume() {
              super.onResume();
              sensorManager.registerListener(this, defaultSensor, SensorManager.SENSOR_DELAY_GAME);//注冊(cè)傳感器
          }
      
          @Override
          protected void onDestroy() {
              super.onDestroy();
              sensorManager.unregisterListener(this);//注銷傳感器
          }
      
          @Override
          public void onSensorChanged(SensorEvent event) {
              changeLocation(event.values[1], event.values[2]);
          }
      
          @Override
          public void onAccuracyChanged(Sensor sensor, int accuracy) {
      
          }
      
      
          private void changeLocation(float y, float z) {
              FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) cv.getLayoutParams();
              layoutParams.setMargins((int) z * 5, (int) y * 5, 0, 0);//乘2的作用是為了讓效果明顯點(diǎn)
              cv.setLayoutParams(layoutParams);
      
          }
      
      
      
          private void initView() {
              cv = (CardView) findViewById(R.id.cv);
          }
      
      }
      View Code

      activity_send.xml

      <?xml version="1.0" encoding="utf-8"?>
      <FrameLayout
          xmlns:android="http://schemas./apk/res/android"
          xmlns:app="http://schemas./apk/res-auto"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:background="@drawable/bg">
      
          <androidx.cardview.widget.CardView
              android:id="@ id/cv"
              android:layout_width="300dp"
              android:layout_height="400dp"
              android:layout_gravity="center"
              app:cardCornerRadius="10dp"
              app:contentPadding="20dp"
              >
              <TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="15dp"
                  android:text="請(qǐng)選擇您發(fā)布內(nèi)容的類別:" />
      
              <RadioGroup
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal"
                  android:layout_marginTop="40dp"
                  android:gravity="center">
                  <RadioButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="吐槽"/>
                  <RadioButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="表白"/>
                  <RadioButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="交友"/>
                  <RadioButton
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="其他"/>
              </RadioGroup>
      
              <TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="請(qǐng)輸入您要發(fā)布的內(nèi)容:"
                  android:layout_marginTop="75dp"/>
      
              <EditText
                  android:id="@ id/et_data_upass"
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="80dp"
                  />
      
          </androidx.cardview.widget.CardView>
      
          <com.google.android.material.floatingactionbutton.FloatingActionButton
              android:id="@ id/fab"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="bottom|center"
              app:srcCompat="@android:drawable/ic_input_add"
              android:layout_marginBottom="50dp"/>
      
      </FrameLayout>
      View Code

      Fragment_My.java

      package com.example.myteamapplication.Fragment;
      
      import android.content.Context;
      import android.content.Intent;
      import android.os.Bundle;
      import android.view.LayoutInflater;
      import android.view.View;
      import android.view.ViewGroup;
      import android.widget.RadioButton;
      
      import androidx.annotation.Nullable;
      import androidx.fragment.app.Fragment;
      import androidx.fragment.app.FragmentManager;
      import androidx.fragment.app.FragmentTransaction;
      
      import com.example.myteamapplication.Activity.MainActivity;
      import com.example.myteamapplication.Activity.SendActivity;
      import com.example.myteamapplication.R;
      
      public class Fragment_My extends Fragment implements View.OnClickListener {
      
          private FragmentTransaction transaction;
          private FragmentManager manager;
          private RadioButton my_tab_send,my_tab_receive;
          private Context MainActivity;
          private LayoutInflater inflater;
      
      //    @Override
      //    public void onActivityCreated(Bundle savedInstanceState) {
      //        super.onActivityCreated(savedInstanceState);
      //        MainActivity = getActivity();
      //        inflater = LayoutInflater.from(getActivity());
      //    }
      
          @Override
          public void onCreate(Bundle savedInstanceState) {
              super.onCreate(savedInstanceState);
              manager = getChildFragmentManager();
              transaction = manager.beginTransaction();
              transaction.add(R.id.fragment_container_my,new Fragment_My_send());
              transaction.commit();
          }
      
          @Override
          public View onCreateView(LayoutInflater inflater, ViewGroup container,
                                   Bundle savedInstanceState) {
              // Inflate the layout for this fragment
              View rootView = inflater.inflate(R.layout.fragment_my, container, false);
              my_tab_send = rootView.findViewById(R.id.my_tab_send);
              my_tab_receive = rootView.findViewById(R.id.my_tab_receive);
              my_tab_send.setOnClickListener(this);
              my_tab_receive.setOnClickListener(this);
              return rootView;
          }
      
      
          @Override
          public void onClick(View v) {
              transaction = manager.beginTransaction();
              switch (v.getId()){
                  case R.id.my_tab_send:
                      transaction.replace(R.id.fragment_container_my,new Fragment_My_send());
                      break;
                  case R.id.my_tab_receive:
                      transaction.replace(R.id.fragment_container_my,new Fragment_My_receive());
                      break;
              }
              transaction.commit();
          }
      }
      View Code

      fragment_my.xml

      <?xml version="1.0" encoding="utf-8"?>
      <RelativeLayout xmlns:android="http://schemas./apk/res/android"
          xmlns:tools="http://schemas./tools"
          android:layout_width="match_parent"
          android:layout_height="match_parent">
      
          <FrameLayout
              android:id="@ id/fragment_container_my"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:layout_below="@ id/ll" />
      
          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:id="@ id/ll"
              android:background="#dcdcdc"
              android:orientation="vertical">
              <TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="用戶頭像和id和用戶名"/>
              <RadioGroup
                  android:id="@ id/tabs_rg_my"
                  android:layout_width="match_parent"
                  android:layout_height="56dp"
                  android:orientation="horizontal">
      
                  <RadioButton
                      android:id="@ id/my_tab_send"
                      style="@style/Custom.TabRadioButton"
                      android:checked="true"
                      android:drawableTop="@drawable/tab_sign_selector"
                      android:text="我的發(fā)帖" />
      
                  <RadioButton
                      android:id="@ id/my_tab_receive"
                      style="@style/Custom.TabRadioButton"
                      android:drawableTop="@drawable/tab_record_selector"
                      android:text="我的回帖" />
      
              </RadioGroup>
          </LinearLayout>
      
      </RelativeLayout>
      View Code

      四、今日?qǐng)F(tuán)隊(duì)鏈接

      https://www.cnblogs.com/three3/p/12728120.html

      來(lái)源:https://www./content-4-678851.html

        本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評(píng)論

        發(fā)表

        請(qǐng)遵守用戶 評(píng)論公約

        類似文章 更多