主頁 > 移動端開發 > 安卓開發學習——day2

安卓開發學習——day2

2021-01-09 11:25:51 移動端開發

今天主要使用的布局:LinerLayout
使用的控制元件有:TextView ListView EditView RadioGroup RadioButton Button Spinner

File -> New ->Activity ->Empty Activity
這樣就能直接生成檔案:新建ListActivity
第二步.點擊res -> layout ->【activity_list.xml】
分析頁面元素:發現是有7個重復的板塊,每個版本都是由4部分組成

在這里插入圖片描述
進入撰寫階段:
【style.xml】

<style name="list_text_one">
        <item name="android:layout_width">0dp</item>
        <item name="android:layout_height">match_parent</item>
        <item name="android:gravity">center</item>
        <item name="android:textSize">50sp</item>
        <item name="android:textColor">@color/black</item>
    </style>

【activity_list.xml】

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".ListActivity">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:background="@drawable/custom_border_">
        <TextView
            android:layout_weight="3"
            android:text="5"
            style="@style/list_text_one"/>
        <LinearLayout
            android:layout_weight="7"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:padding="5dp">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="2014-02-19 17:50:35"
                android:textColor="@color/black"
                android:textSize="15sp"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="Admin"
                android:textColor="@color/black"
                android:textSize="15sp"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="2014-2-19"
                android:textColor="@color/black"
                android:textSize="15sp"/>
        </LinearLayout>
        <TextView
            android:id="@+id/tvAudit"
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="未審"
            android:gravity="center_vertical |right"
            android:textSize="16sp"/>
        <Button
            android:id="@+id/btnAudit"
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:text="審核"
            android:gravity="center"
            android:textSize="22sp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:background="@drawable/custom_border_">
        <TextView
            android:layout_weight="3"
            android:text="6"
            style="@style/list_text_one"/>
        <LinearLayout
            android:layout_weight="7"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:padding="5dp">
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="2014-02-19 17:50:35"
                android:textColor="@color/black"
                android:textSize="15sp"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="Admin"
                android:textColor="@color/black"
                android:textSize="15sp"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="1"
                android:text="2014-2-19"
                android:textColor="@color/black"
                android:textSize="15sp"/>
        </LinearLayout>
        <TextView
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="未審"
            android:gravity="center_vertical |right"
            android:textSize="16sp"/>
        <Button
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:text="審核"
            android:gravity="center"
            android:textSize="22sp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:background="@drawable/custom_border_">
        <TextView
            android:layout_weight="3"
            android:text="6"
            style="@style/list_text_one"/>
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="7"
            android:paddingTop="5dp"
            android:lines="3"
            android:text="2014-02-19 17:50:35\nAdmin\n2014-02-19"
            android:textColor="@color/black"
            android:textSize="15sp"
            android:lineSpacingMultiplier="2"/>
        <TextView
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="未審"
            android:gravity="center_vertical |right"
            android:textSize="16sp"/>
        <Button
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:text="審核"
            android:gravity="center"
            android:textSize="22sp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:background="@drawable/custom_border_">
        <TextView
            android:layout_weight="3"
            android:text="8"
            style="@style/list_text_one"/>
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="7"
            android:paddingTop="5dp"
            android:lines="3"
            android:text="2014-02-19 17:50:35\nAdmin\n2014-02-19"
            android:textColor="@color/black"
            android:textSize="15sp"
            android:lineSpacingMultiplier="2"/>
        <TextView
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="未審"
            android:gravity="center_vertical |right"
            android:textSize="16sp"/>
        <Button
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:text="審核"
            android:gravity="center"
            android:textSize="22sp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:background="@drawable/custom_border_">
        <TextView
            android:layout_weight="3"
            android:text="9"
            style="@style/list_text_one"/>
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="7"
            android:paddingTop="5dp"
            android:lines="3"
            android:text="2014-02-19 17:50:35\nAdmin\n2014-02-19"
            android:textColor="@color/black"
            android:textSize="15sp"
            android:lineSpacingMultiplier="2"/>
        <TextView
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="未審"
            android:gravity="center_vertical |right"
            android:textSize="16sp"/>
        <Button
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:text="審核"
            android:gravity="center"
            android:textSize="22sp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:background="@drawable/custom_border_">
        <TextView
            android:layout_weight="3"
            android:text="10"
            style="@style/list_text_one"/>
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="7"
            android:paddingTop="5dp"
            android:lines="3"
            android:text="2014-02-19 17:50:35\nAdmin\n2014-02-19"
            android:textColor="@color/black"
            android:textSize="15sp"
            android:lineSpacingMultiplier="2"/>
        <TextView
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="未審"
            android:gravity="center_vertical |right"
            android:textSize="16sp"/>
        <Button
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:text="審核"
            android:gravity="center"
            android:textSize="22sp"/>
    </LinearLayout>
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="horizontal"
        android:background="@drawable/custom_border_">
        <TextView
            android:layout_weight="3"
            android:text="11"
            style="@style/list_text_one"/>
        <TextView
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="7"
            android:paddingTop="5dp"
            android:lines="3"
            android:text="2014-02-19 17:50:35\nAdmin\n2014-02-19"
            android:textColor="@color/black"
            android:textSize="15sp"
            android:lineSpacingMultiplier="2"/>
        <TextView
            android:layout_weight="2"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:text="未審"
            android:gravity="center_vertical |right"
            android:textSize="16sp"/>
        <Button
            android:layout_weight="3"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_margin="10dp"
            android:text="審核"
            android:gravity="center"
            android:textSize="22sp"/>
    </LinearLayout>
</LinearLayout>

到這里就能預覽效果了:
預覽Activity_list

【ListActivity.java】

package com.example.firemanager;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;

public class ListActivity extends AppCompatActivity {
    private Button btnAudit;
    private TextView tvAudit;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);

        lvDatetime = findViewById(R.id.lvDatetime);
        btnAudit = findViewById(R.id.btnAudit);
        tvAudit = findViewById(R.id.tvAudit);
        
        btnAudit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                tvAudit.setText("已審");
            }
        });

    }
}

最后查看【manifests】

<activity android:name=".ListActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

點擊運行:
在這里插入圖片描述

查看第二張圖片:
元素相比第一個多了很多
在這里插入圖片描述
同樣新建模板:
在這里插入圖片描述

【string.xml】

<resources>
    <string name="app_name">FireManager</string>
    <string name="time">交付時間:</string>
    <string name="number">數量:</string>
    <string name="engine">發動機排量:</string>
    <string name="gearbox">變速箱:</string>
    <string name="wheel">輪轂:</string>
    <string name="central">中控:</string>
    <string name="brake">剎車:</string>
    <string name="hang">懸掛:</string>

    <string-array name="hang_list">
        <item>獨立懸掛系統</item>
        <item>主動懸掛系統</item>
        <item>橫臂式懸掛系統</item>
        <item>縱臂式懸掛系統</item>
        <item>燭式懸掛系統</item>
        <item>多連桿式懸掛系統</item>
        <item>麥弗遜式懸掛系統</item>
    </string-array>
    <string-array name="emissions_list">
        <item>1.0</item>
        <item>2.0</item>
        <item>3.0</item>
        <item>4.0</item>
    </string-array>
    <string-array name="datetime_info">
        <item>2014-02-19 17:50:35</item>
        <item>Admin</item>
        <item>2014-02-19</item>
    </string-array>
</resources>

【activity_form.xml】

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/basic"
    android:orientation="vertical"
    android:padding="4dp"
    tools:context=".FormActivity">

    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1"
        >
        <TextView
            android:id="@+id/tvTime"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/time"
            android:textColor="@color/black"
            android:textSize="15dp"/>
        
    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1">
        <TextView
            android:id="@+id/tvNum"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/number"
            android:textColor="@color/black"
            android:textSize="15dp"/>
        <EditText
            android:id="@+id/edNum"
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@drawable/edit_background"
            android:lines="1"/>
    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1"
    >
        <TextView
            android:id="@+id/tvEngine"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/engine"
            android:textColor="@color/black"
            android:textSize="15dp"/>
        <Spinner
            android:layout_width="120dp"
            android:layout_height="wrap_content"
            android:background="@drawable/edit_background"
            android:entries="@array/emissions_list"/>
    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1"
        >
        <TextView
            android:id="@+id/tvGearbox"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/gearbox"
            android:textColor="@color/black"
            android:textSize="15dp"/>
        <RadioGroup
            android:id="@+id/rgGearbox"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:gravity="center">
            <RadioButton
                android:id="@+id/rbCearbox_1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="自動"
                android:checked="true"/>
            <RadioButton
                android:id="@+id/rbCearbox_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="手動"/>
        </RadioGroup>
    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1">
        <TextView
            android:id="@+id/tvWheel"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/wheel"
            android:textColor="@color/black"
            android:textSize="15dp"/>
        <RadioGroup
            android:id="@+id/rgWheel"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:gravity="center">
            <RadioButton
                android:id="@+id/rbWheel_1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="烤漆"
                android:checked="true"/>
            <RadioButton
                android:id="@+id/rbWheel_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="電鍍"/>
        </RadioGroup>
    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1"
        >
        <TextView
            android:id="@+id/tvCentral"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/central"
            android:textColor="@color/black"
            android:textSize="15dp"/>
        <RadioGroup
            android:id="@+id/rgCentral"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:gravity="center">
            <RadioButton
                android:id="@+id/rbCentral_1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="低配"
                android:checked="true"/>
            <RadioButton
                android:id="@+id/rbCentral_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="高配"/>
        </RadioGroup>
    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1"
        >
        <TextView
            android:id="@+id/tvBreak"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/brake"
            android:textColor="@color/black" />
        <RadioGroup
            android:id="@+id/rgBreak"
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:orientation="horizontal"
            android:gravity="center">
            <RadioButton
                android:id="@+id/rbBreak_1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="鼓式制動器"
                android:checked="true"/>
            <RadioButton
                android:id="@+id/rbBreak_2"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="盤式制動器"/>
        </RadioGroup>

    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="1"
        >
        <TextView
            android:id="@+id/tvHang"
            android:layout_width="90dp"
            android:layout_height="wrap_content"
            android:text="@string/hang"
            android:textColor="@color/black"
            android:textSize="15dp"/>
        <Spinner
            android:id="@+id/spHang"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/edit_background"
            android:entries="@array/hang_list"/>
    </LinearLayout>
    <LinearLayout
        style="@style/form_liner"
        android:layout_weight="2">
    </LinearLayout>

    <LinearLayout
        style="@style/form_liner"
        android:gravity="center_horizontal"
        android:layout_margin="0dp"
        android:layout_weight="2">
        <Button
            android:layout_width="100dp"
            android:layout_height="80dp"
            android:text="確定"
            android:background="@drawable/custom_border_"/>
    </LinearLayout>



</LinearLayout>

【style.xml】

<style name="form_liner">
        <item name="android:layout_width">match_parent</item>
        <item name="android:layout_height">0dp</item>
        <item name="android:background">@color/white</item>
        <item name="android:layout_margin">2dp</item>
        <item name="android:gravity">center_vertical</item>
        <item name="android:padding">10dp</item>
    </style>

【ListActivity.java】

package com.example.firemanager;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.DatePicker;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.NumberPicker;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TimePicker;

import java.util.ArrayList;
import java.util.List;

public class FormActivity extends AppCompatActivity {
    //變速箱
    private RadioGroup rgGearbox;
    private RadioButton rbGearbox_1;
    private RadioButton rbGearbox_2;
    //輪轂
    private RadioGroup rgWheel;
    private RadioButton rbWheel_1;
    private RadioButton rbWheel_2;
    //中控
    private RadioGroup rgCentral;
    private RadioButton rbCentral_1;
    private RadioButton rbCentral_2;
    //剎車
    private RadioGroup rgBreak;
    private RadioButton rbBreak_1;
    private RadioButton rbBreak_2;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_form);

        rgGearbox = findViewById(R.id.rgGearbox);
        rbGearbox_1 = findViewById(R.id.rbCearbox_1);
        rbGearbox_2 = findViewById(R.id.rbCearbox_2);

        rgWheel = findViewById(R.id.rgWheel);
        rbWheel_1= findViewById(R.id.rbWheel_1);
        rbWheel_2 = findViewById(R.id.rbWheel_2);

        rgCentral = findViewById(R.id.rgCentral);
        rbCentral_1 = findViewById(R.id.rbCentral_1);
        rbCentral_2 = findViewById(R.id.rbCentral_2);

        rgBreak = findViewById(R.id.rgBreak);
        rbBreak_1 = findViewById(R.id.rbBreak_1);
        rbBreak_2 = findViewById(R.id.rbBreak_2);

        rgGearbox.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(rbGearbox_1.isChecked()) {
                    rbGearbox_2.setChecked(false);
                } else {
                    rbGearbox_1.setChecked(false);
                }
            }
        });

        rgWheel.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(rbWheel_1.isChecked()) {
                    rbWheel_2.setChecked(false);
                } else {
                    rbWheel_1.setChecked(false);
                }
            }
        });

        rgCentral.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(rbCentral_1.isChecked()) {
                    rbCentral_2.setChecked(false);
                } else {
                    rbCentral_1.setChecked(false);
                }
            }
        });
        rgBreak.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(RadioGroup group, int checkedId) {
                if(rbBreak_1.isChecked()) {
                    rbBreak_2.setChecked(false);
                } else {
                    rbBreak_1.setChecked(false);
                }
            }
        });
    }

}

【Manifests】

<activity android:name=".FormActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

最后運行:
在這里插入圖片描述


問題:日期選擇未能完成
在這里插入圖片描述


總結:今天的練習使我插件的使用了解更加深刻,在寫代碼的程序中寫了,會有很多重復的布局,昨天其實也發現了這問題,我看到別人的代碼把一些重復的都寫到style.xml里面來呼叫,今天我也嘗試的做了,著實能使代碼更簡潔,我還發現xml里面的單選框并不能直接實作單選的效果,百度查看發現還需要在java檔案里撰寫事件,

轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/246584.html

標籤:其他

上一篇:安卓學習日志 — Day02

下一篇:安卓基礎學習 Day01 |第一個安卓應用程式:Hello Word!

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 【從零開始擼一個App】Dagger2

    Dagger2是一個IOC框架,一般用于Android平臺,第一次接觸的朋友,一定會被搞得暈頭轉向。它延續了Java平臺Spring框架代碼碎片化,注解滿天飛的傳統。嘗試將各處代碼片段串聯起來,理清思緒,真不是件容易的事。更不用說還有各版本細微的差別。 與Spring不同的是,Spring是通過反射 ......

    uj5u.com 2020-09-10 06:57:59 more
  • Flutter Weekly Issue 66

    新聞 Flutter 季度調研結果分享 教程 Flutter+FaaS一體化任務編排的思考與設計 詳解Dart中如何通過注解生成代碼 GitHub 用對了嗎?Flutter 團隊分享如何管理大型開源專案 插件 flutter-bubble-tab-indicator A Flutter librar ......

    uj5u.com 2020-09-10 06:58:52 more
  • Proguard 常用規則

    介紹 Proguard 入口,如何查看輸出,如何使用 keep 設定入口以及使用實體,如何配置壓縮,混淆,校驗等規則。

    ......

    uj5u.com 2020-09-10 06:59:00 more
  • Android 開發技術周報 Issue#292

    新聞 Android即將獲得類AirDrop功能:可向附近設備快速分享檔案 谷歌為安卓檔案管理應用引入可安全隱藏資料的Safe Folder功能 Android TV新主界面將顯示電影、電視節目和應用推薦內容 泄露的Android檔案暗示了傳說中的谷歌Pixel 5a與折疊屏新機 谷歌發布Andro ......

    uj5u.com 2020-09-10 07:00:37 more
  • AutoFitTextureView Error inflating class

    報錯: Binary XML file line #0: Binary XML file line #0: Error inflating class xxx.AutoFitTextureView 解決: <com.example.testy2.AutoFitTextureView android: ......

    uj5u.com 2020-09-10 07:00:41 more
  • 根據Uri,Cursor沒有獲取到對應的屬性

    Android: 背景:呼叫攝像頭,拍攝視頻,指定保存的地址,但是回傳的Cursor檔案,只有名稱和大小的屬性,沒有其他諸如時長,連ID屬性都沒有 使用 cursor.getInt(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DURATIO ......

    uj5u.com 2020-09-10 07:00:44 more
  • Android連載29-持久化技術

    一、持久化技術 我們平時所使用的APP產生的資料,在記憶體中都是瞬時的,會隨著斷電、關機等丟失資料,因此android系統采用了持久化技術,用于存盤這些“瞬時”資料 持久化技術包括:檔案存盤、SharedPreference存盤以及資料庫存盤,還有更復雜的SD卡記憶體儲。 二、檔案存盤 最基本存盤方式, ......

    uj5u.com 2020-09-10 07:00:47 more
  • Android Camera2Video整合到自己專案里

    背景: Android專案里呼叫攝像頭拍攝視頻,原本使用的 MediaStore.ACTION_VIDEO_CAPTURE, 后來因專案需要,改成了camera2 1.Camera2Video 官方demo有點問題,下載后,不能直接整合到專案 問題1.多次拍攝視頻崩潰 問題2.雙擊record按鈕, ......

    uj5u.com 2020-09-10 07:00:50 more
  • Android 開發技術周報 Issue#293

    新聞 谷歌為Android TV開發者提供多種新功能 Android 11將自動填表功能整合到鍵盤輸入建議中 谷歌宣布Android Auto即將支持更多的導航和數字停車應用 谷歌Pixel 5只有XL版本 搭載驍龍765G且將比Pixel 4更便宜 [圖]Wear OS將迎來重磅更新:應用啟動時間 ......

    uj5u.com 2020-09-10 07:01:38 more
  • 海豚星空掃碼投屏 Android 接收端 SDK 集成 六步驟

    掃碼投屏,開放網路,獨占設備,不需要額外下載軟體,微信掃碼,發現設備。支持標準DLNA協議,支持倍速播放。視頻,音頻,圖片投屏。好點意思。還支持自定義基于 DLNA 擴展的操作動作。好像要收費,沒體驗。 這里簡單記錄一下集成程序。 一 跟目錄的build.gradle添加私有mevan倉庫 mave ......

    uj5u.com 2020-09-10 07:01:43 more
最新发布
  • 歡迎頁輪播影片

    如圖,引導開始,球從上落下,同時淡入文字,然后文字開始輪播,最后一頁時停止,點擊進入首頁。 在來看看效果圖。 重力球先不講,主要歡迎輪播簡單實作 首先新建一個類 TextTranslationXGuideView,用于影片展示 文本是類似的,最后會有個圖片箭頭影片,布局很簡單,就是一個 TextVi ......

    uj5u.com 2023-04-20 08:40:31 more
  • 【FAQ】關于華為推送服務因營銷訊息頻次管控導致服務通訊類訊息

    一. 問題描述 使用華為推送服務下發IM訊息時,下發訊息請求成功且code碼為80000000,但是手機總是收不到訊息; 在華為推送自助分析(Beta)平臺查看發現,訊息發送觸發了頻控。 二. 問題原因及背景 2023年1月05日起,華為推送服務對咨詢營銷類訊息做了單個設備每日推送數量上限管理,具體 ......

    uj5u.com 2023-04-20 08:40:11 more
  • 歡迎頁輪播影片

    如圖,引導開始,球從上落下,同時淡入文字,然后文字開始輪播,最后一頁時停止,點擊進入首頁。 在來看看效果圖。 重力球先不講,主要歡迎輪播簡單實作 首先新建一個類 TextTranslationXGuideView,用于影片展示 文本是類似的,最后會有個圖片箭頭影片,布局很簡單,就是一個 TextVi ......

    uj5u.com 2023-04-20 08:39:36 more
  • 【FAQ】關于華為推送服務因營銷訊息頻次管控導致服務通訊類訊息

    一. 問題描述 使用華為推送服務下發IM訊息時,下發訊息請求成功且code碼為80000000,但是手機總是收不到訊息; 在華為推送自助分析(Beta)平臺查看發現,訊息發送觸發了頻控。 二. 問題原因及背景 2023年1月05日起,華為推送服務對咨詢營銷類訊息做了單個設備每日推送數量上限管理,具體 ......

    uj5u.com 2023-04-20 08:39:13 more
  • iOS從UI記憶體地址到讀取成員變數(oc/swift)

    開發除錯時,我們發現bug時常首先是從UI顯示發現例外,下一步才會去定位UI相關連的資料的。XCode有給我們提供一系列debug工具,但是很多人可能還沒有形成一套穩定的除錯流程,因此本文嘗試解決這個問題,順便提出一個暴論:UI顯示例外問題只需要兩個步驟就能完成定位作業的80%: 定位例外 UI 組 ......

    uj5u.com 2023-04-19 09:16:23 more
  • FIDE重磅更新!性能飛躍!體驗有禮!

    FIDE 開發者工具重構升級啦!實作500%性能提升,誠邀體驗! 一直以來不少開發者朋友在社區反饋,在使用 FIDE 工具的程序中,時常會遇到諸如加載不及時、代碼預覽/渲染性能不如意的情況,十分影響開發體驗。 作為技術團隊,我們深知一件趁手的開發工具對開發者的重要性,因此,在2023年開年,FinC ......

    uj5u.com 2023-04-19 09:16:15 more
  • 游戲內嵌社區服務開放,助力開發者提升玩家互動與留存

    華為 HMS Core 游戲內嵌社區服務提供快速訪問華為游戲中心論壇能力,支持玩家直接在游戲內瀏覽帖子和交流互動,助力開發者擴展內容生產和觸達的場景。 一、為什么要游戲內嵌社區? 二、游戲內嵌社區的典型使用場景 1、游戲內打開論壇 您可以在游戲內繪制論壇入口,為玩家提供沉浸式發帖、瀏覽、點贊、回帖、 ......

    uj5u.com 2023-04-19 09:15:46 more
  • iOS從UI記憶體地址到讀取成員變數(oc/swift)

    開發除錯時,我們發現bug時常首先是從UI顯示發現例外,下一步才會去定位UI相關連的資料的。XCode有給我們提供一系列debug工具,但是很多人可能還沒有形成一套穩定的除錯流程,因此本文嘗試解決這個問題,順便提出一個暴論:UI顯示例外問題只需要兩個步驟就能完成定位作業的80%: 定位例外 UI 組 ......

    uj5u.com 2023-04-19 09:14:53 more
  • FIDE重磅更新!性能飛躍!體驗有禮!

    FIDE 開發者工具重構升級啦!實作500%性能提升,誠邀體驗! 一直以來不少開發者朋友在社區反饋,在使用 FIDE 工具的程序中,時常會遇到諸如加載不及時、代碼預覽/渲染性能不如意的情況,十分影響開發體驗。 作為技術團隊,我們深知一件趁手的開發工具對開發者的重要性,因此,在2023年開年,FinC ......

    uj5u.com 2023-04-19 09:14:08 more
  • 游戲內嵌社區服務開放,助力開發者提升玩家互動與留存

    華為 HMS Core 游戲內嵌社區服務提供快速訪問華為游戲中心論壇能力,支持玩家直接在游戲內瀏覽帖子和交流互動,助力開發者擴展內容生產和觸達的場景。 一、為什么要游戲內嵌社區? 二、游戲內嵌社區的典型使用場景 1、游戲內打開論壇 您可以在游戲內繪制論壇入口,為玩家提供沉浸式發帖、瀏覽、點贊、回帖、 ......

    uj5u.com 2023-04-19 09:08:34 more