国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

[Android Studio] 個(gè)人主頁(yè)界面的實(shí)現(xiàn)

這篇具有很好參考價(jià)值的文章主要介紹了[Android Studio] 個(gè)人主頁(yè)界面的實(shí)現(xiàn)。希望對(duì)大家有所幫助。如果存在錯(cuò)誤或未考慮完全的地方,請(qǐng)大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問(wèn)。

目錄

接上篇:底部導(dǎo)航欄的實(shí)現(xiàn)

1.個(gè)人主頁(yè)界面的設(shè)計(jì):fragment_blank.xml

2.個(gè)人主頁(yè)功能的實(shí)現(xiàn)類(lèi):BlankFragment.java

3.每日簽到功能的實(shí)現(xiàn)

4.實(shí)現(xiàn)效果

5.圖片素材


接上篇:[Android Studio] 底部導(dǎo)航欄的實(shí)現(xiàn)

1.個(gè)人主頁(yè)界面的設(shè)計(jì):fragment_blank.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="?attr/colorOnPrimary"
    tools:context=".ui.blank.BlankFragment">

    <androidx.appcompat.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:layout_alignParentTop="true"
        android:background="?attr/colorPrimary">
    </androidx.appcompat.widget.Toolbar>

    <androidx.cardview.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="180dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="70dp"
        app:cardCornerRadius="10dp"
        app:cardElevation="0dp"
        >
    </androidx.cardview.widget.CardView>

    <de.hdodenhof.circleimageview.CircleImageView
        android:id="@+id/app_img"
        android:layout_width="match_parent"
        android:layout_height="80dp"
        android:layout_marginTop="35dp"
        android:layout_centerHorizontal="true"
        android:src="@drawable/app_img" />

    <TextView
        android:id="@+id/name"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/app_img"
        android:layout_marginBottom="5dp"
        android:layout_marginTop="10dp"
        android:gravity="center"
        android:maxLength="6"
        android:text="賬單日記"
        android:textColor="@android:color/black"
        android:textSize="18sp"
        android:textStyle="bold" />

    <LinearLayout
        android:id="@+id/liner"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/name"
        android:layout_margin="20dp"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/signup"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_weight="4"
            android:gravity="center"
            android:text="每日簽到"
            android:textColor="#333333"
            android:layout_marginTop="5dp"
            android:textSize="15sp" />

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_weight="6">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="3"
                android:gravity="center"
                android:text="累計(jì)簽到:"
                android:textColor="#333333"
                android:textSize="15sp" />
            <TextView
                android:id="@+id/clock_day"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="3"
                android:gravity="center"
                android:text="0"
                android:textColor="#F43678"
                android:textSize="20sp" />
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_weight="4"
                android:gravity="center"
                android:text="天"
                android:textColor="#333333"
                android:textSize="15sp" />
        </LinearLayout>
    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_marginBottom="30dp"
        android:layout_below="@id/liner"
        android:background="@drawable/kuang"
        android:layout_marginTop="50dp">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#1A000000"/>

        <RelativeLayout
            android:id="@+id/budget_btn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:clickable="true">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/budget"
                android:layout_centerVertical="true"
                android:layout_marginLeft="20dp"/>

            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="預(yù)算中心"
                android:textSize="16sp"
                android:layout_marginLeft="70dp"
                android:layout_centerVertical="true"/>

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/right"
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:layout_marginRight="20dp"/>

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#1A000000"/>

        <RelativeLayout
            android:id="@+id/usehelp_btn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:clickable="true">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/usinghelp"
                android:layout_marginLeft="20dp"
                android:layout_centerVertical="true"/>

            <TextView
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:text="使用幫助"
                android:textSize="16sp"
                android:layout_marginLeft="70dp"
                android:layout_centerVertical="true"/>

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/right"
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:layout_marginRight="20dp"/>

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#1A000000"/>

        <RelativeLayout
            android:id="@+id/about_btn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:clickable="true">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/about"
                android:layout_centerVertical="true"
                android:layout_marginLeft="20dp"/>

            <TextView
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:text="關(guān)于我們"
                android:textSize="16sp"
                android:layout_marginLeft="70dp"
                android:layout_centerVertical="true" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/right"
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:layout_marginRight="20dp"/>

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#1A000000"/>

        <RelativeLayout
            android:id="@+id/setting_btn"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:clickable="true">

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/setting"
                android:layout_centerVertical="true"
                android:layout_marginLeft="20dp"/>

            <TextView
                android:layout_width="80dp"
                android:layout_height="wrap_content"
                android:text="設(shè)         置"
                android:textSize="16sp"
                android:layout_marginLeft="70dp"
                android:layout_centerVertical="true" />

            <ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:src="@mipmap/right"
                android:layout_centerVertical="true"
                android:layout_alignParentRight="true"
                android:layout_marginRight="20dp"/>

        </RelativeLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:background="#1A000000"/>


    </LinearLayout>

</RelativeLayout>

2.個(gè)人主頁(yè)功能的實(shí)現(xiàn)類(lèi):BlankFragment.java

package com.example.ji_zhang_ben.ui.blank;

import android.app.AlertDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.ji_zhang_ben.R;


public class BlankFragment extends Fragment implements View.OnClickListener{

    TextView signup,clock_day;//每日簽到,顯示簽到的天數(shù)
    RelativeLayout budget_btn,usehelp_btn,about_btn,setting_btn;  //預(yù)算中心,使用幫助,關(guān)于我們,設(shè)置
    View sigup_view;  //簽到彈窗視圖
    AlertDialog write;
    SharedPreferences sp;
    SharedPreferences.Editor editor;

    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        View view= inflater.inflate(R.layout.fragment_blank, container, false);

        budget_btn = view.findViewById(R.id.budget_btn);
        usehelp_btn = view.findViewById(R.id.usehelp_btn);
        about_btn = view.findViewById(R.id.about_btn);
        setting_btn = view.findViewById(R.id.setting_btn);
        signup = view.findViewById(R.id.signup);
        clock_day = view.findViewById(R.id.clock_day);

        budget_btn.setOnClickListener(this);
        usehelp_btn.setOnClickListener(this);
        about_btn.setOnClickListener(this);
        setting_btn.setOnClickListener(this);
        signup.setOnClickListener(this);
        
        //設(shè)置累計(jì)簽到的天數(shù)
        sp =getActivity().getSharedPreferences("tice", Context.MODE_PRIVATE);
        clock_day.setText(sp.getString("tice","0"));

        return view;

    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.signup://簽到
                setSignup();
                break;
            case R.id.budget_btn://預(yù)算中心
                Intent intent2 = new Intent(getContext(),BudgetActivity.class);
                startActivity(intent2);
                break;
            case R.id.usehelp_btn://使用幫助
                Intent intent3 = new Intent(getContext(),UsehelpActivity.class);
                startActivity(intent3);
                break;
            case R.id.about_btn://關(guān)于我們
                Intent intent4 = new Intent(getContext(),AboutActivity.class);
                startActivity(intent4);
                break;
            case R.id.setting_btn://設(shè)置
                Intent intent5 = new Intent(getContext(),SettingActivity.class);
                startActivity(intent5);
                break;

        }
    }

    //簽到功能的實(shí)現(xiàn)
    public void setSignup(){

        //顯示簽到成功視圖
        write = new AlertDialog.Builder(getActivity()).create();
        sigup_view = LayoutInflater.from(getActivity()).inflate(R.layout.pop_up_signup,null);
        write.setView(sigup_view);
        write.show();

        int count = Integer.parseInt(clock_day.getText().toString())+1;

        editor = sp.edit();
        editor.putString("tice",Integer.toString(count));
        editor.commit(); //寫(xiě)入
        onResume();//刷新
    }

    @Override
    public void onResume() {
        super.onResume();
        SharedPreferences sp =getActivity().getSharedPreferences("tice",Context.MODE_PRIVATE);
        clock_day.setText(sp.getString("tice","0"));
    }
}

?補(bǔ)充說(shuō)明:注意配置AndroidManifest.xml文件

<activity
    android:name=".ui.blank.BudgetActivity"
    android:exported="false" />
<activity
    android:name=".ui.blank.SettingActivity"
    android:exported="false" />
<activity
    android:name=".ui.blank.AboutActivity"
    android:exported="false" />
<activity
    android:name=".ui.blank.UsehelpActivity"
    android:exported="false" />

3.每日簽到功能的實(shí)現(xiàn)

自定義彈窗布局文件:pop_up_signup.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">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="50dp"
        android:layout_gravity="center_vertical"
        android:orientation="horizontal">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="70dp"
            android:layout_gravity="center"
            android:src="@mipmap/laud"></ImageView>

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_margin="10dp"
            android:layout_gravity="center"
            android:text="簽到成功"
            android:textSize="30sp"
            android:textStyle="bold"></TextView>

    </LinearLayout>

</LinearLayout>

累計(jì)簽到的天數(shù),采用的是SharedPreferences存儲(chǔ),一開(kāi)始先獲取里面的值,然后設(shè)置控件id:clock_day的值。

//設(shè)置累計(jì)簽到的天數(shù) 
    sp =getActivity().getSharedPreferences("tice", Context.MODE_PRIVATE);                 
    clock_day.setText(sp.getString("tice","0"));

當(dāng)點(diǎn)擊 每日簽到 時(shí),跳出彈窗提示簽到成功,同時(shí)獲取當(dāng)前累計(jì)簽到的天數(shù)值并加1,然后將結(jié)果寫(xiě)入SharedPreferences中,并刷新。

 //簽到功能的實(shí)現(xiàn)
    public void setSignup(){

        //顯示簽到成功視圖
        write = new AlertDialog.Builder(getActivity()).create();
        sigup_view = LayoutInflater.from(getActivity()).inflate(R.layout.pop_up_signup,null);
        write.setView(sigup_view);
        write.show();

        int count = Integer.parseInt(clock_day.getText().toString())+1;

        editor = sp.edit();
        editor.putString("tice",Integer.toString(count));
        editor.commit(); //寫(xiě)入
        onResume();//刷新
    }

4.實(shí)現(xiàn)效果

android studio個(gè)人設(shè)置界面,Android Studio,android studio,android

5.圖片素材

android studio個(gè)人設(shè)置界面,Android Studio,android studio,androidandroid studio個(gè)人設(shè)置界面,Android Studio,android studio,androidandroid studio個(gè)人設(shè)置界面,Android Studio,android studio,androidandroid studio個(gè)人設(shè)置界面,Android Studio,android studio,androidandroid studio個(gè)人設(shè)置界面,Android Studio,android studio,android文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-802934.html

到了這里,關(guān)于[Android Studio] 個(gè)人主頁(yè)界面的實(shí)現(xiàn)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來(lái)自互聯(lián)網(wǎng)用戶(hù)投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場(chǎng)。本站僅提供信息存儲(chǔ)空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請(qǐng)注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請(qǐng)點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • 制作github個(gè)人主頁(yè)

    github創(chuàng)建一個(gè)項(xiàng)目命名為.github.io git clone一個(gè)他人的主頁(yè)作為模板 按情況修改readme.md, index.html中名字,郵箱,github,google scholor 如果您創(chuàng)建的 .github.io 倉(cāng)庫(kù)的 部分與您的 GitHub 用戶(hù)名不一樣,您需要通過(guò) GitHub Pages 設(shè)置來(lái)指定要使用的用戶(hù)名。以下是具體的步驟: 進(jìn)入 .github

    2024年01月25日
    瀏覽(32)
  • 23.實(shí)戰(zhàn)演練--個(gè)人主頁(yè)
  • 微信小程序--個(gè)人主頁(yè)的制作

    微信小程序--個(gè)人主頁(yè)的制作

    1. 效果圖: 2.頁(yè)面wxml的布局邏輯 (1)代碼: 3.頁(yè)面wxss的設(shè)置 (1)代碼: 1. 獲取登錄信息 (1)Userinfo:獲取用戶(hù)信息 (2)avatarUrl:用戶(hù)頭像 (3)nickName:用戶(hù)昵稱(chēng) (4)zh_CN:簡(jiǎn)體中文 (5)注意:這里是獲取兩次用戶(hù)頭像,因?yàn)楸尘耙灿玫牡筋^像 (6)樣式的設(shè)置: 2

    2024年02月09日
    瀏覽(31)
  • html網(wǎng)頁(yè)設(shè)計(jì)小作業(yè)(個(gè)人主頁(yè))

    html網(wǎng)頁(yè)設(shè)計(jì)小作業(yè)(個(gè)人主頁(yè))

    目錄 作品介紹: 效果展示 代碼部分: 簡(jiǎn)易的個(gè)人網(wǎng)頁(yè)小作業(yè),只用了html+css 布局制作,沒(méi)啥好說(shuō)的,直接上圖?。?! Home 頁(yè)面: ?About頁(yè)面: ? ?Hobbies頁(yè)面: Home界面: About頁(yè)面: ?Hobbies頁(yè)面: oKK,就這么多啦。。

    2024年02月11日
    瀏覽(27)
  • 基于github制作個(gè)人學(xué)術(shù)網(wǎng)站(主頁(yè))

    基于github制作個(gè)人學(xué)術(shù)網(wǎng)站(主頁(yè))

    首先找到一個(gè)學(xué)術(shù)模板,fork到遠(yuǎn)程倉(cāng)庫(kù)。academicpages,如果不是很清楚具體的步驟,可以參考保姆級(jí)教程。在github上對(duì)該網(wǎng)站代碼修改不是很方便,肯定是在本地進(jìn)行更新后push到遠(yuǎn)程倉(cāng)庫(kù)。 學(xué)會(huì)下載和安裝就行,一路默認(rèn),可以先學(xué)習(xí)一下Git相關(guān)的原理及基礎(chǔ)操作,可以參考

    2024年02月15日
    瀏覽(68)
  • 個(gè)人Scratch HTML程序合集 主頁(yè)

    個(gè)人Scratch HTML程序合集 主頁(yè) 此程序是本人制作的Scratch HTML程序合集的主頁(yè),使用HTML+CSS編寫(xiě),整合了本人近期發(fā)布的轉(zhuǎn)換為HTML的Scratch程序的內(nèi)容,可以通過(guò)主頁(yè)內(nèi)的鏈接打開(kāi)相應(yīng)的程序和博客。主頁(yè)在本地運(yùn)行,大家可以在github.com下載主頁(yè)文件及相關(guān)資源。 代碼如下

    2024年02月16日
    瀏覽(25)
  • 抖音web版地址個(gè)人主頁(yè)和視頻地址

    https://www.douyin.com/user/MS4wLjABAAAAfLsItSD2WiJrsji1g_iZv-it6W2CcvBFkdUwMjTeSD4 MS4wLjABAAAAfLsItSD2WiJrsji1g_iZv-it6W2CcvBFkdUwMjTeSD4 是 sec_uid。 https://v.douyin.com/h17aA6H https://www.iesdouyin.com/share/user/MS4wLjABAAAAfLsItSD2WiJrsji1g_iZv-it6W2CcvBFkdUwMjTeSD4 MS4wLjABAAAAfLsItSD2WiJrsji1g_iZv-it6W2CcvBFkdUwMjTeSD4 是 sec_uid。 下面的寫(xiě)法

    2024年04月27日
    瀏覽(27)
  • 詳細(xì)講解如何在github上編輯個(gè)人主頁(yè)?

    詳細(xì)講解如何在github上編輯個(gè)人主頁(yè)?

    ?在 GitHub 上編輯個(gè)人主頁(yè)可以讓您展示您的項(xiàng)目、技能和個(gè)人信息,以及與其他開(kāi)發(fā)者互動(dòng)。以下是詳細(xì)的步驟來(lái)在 GitHub 上編輯個(gè)人主頁(yè): 如果您還沒(méi)有 GitHub 賬戶(hù),首先需要注冊(cè)一個(gè)。 使用您的用戶(hù)名和密碼登錄到 GitHub。 您需要?jiǎng)?chuàng)建一個(gè)特殊的倉(cāng)庫(kù),倉(cāng)庫(kù)名必須是 用戶(hù)

    2024年02月13日
    瀏覽(28)
  • 【網(wǎng)站】讓自己的個(gè)人主頁(yè)能被Google檢索

    【網(wǎng)站】讓自己的個(gè)人主頁(yè)能被Google檢索

    參考: https://zhuanlan.zhihu.com/p/129022264 這樣操作之后,等一天左右,個(gè)人主頁(yè)就能被Google搜索到啦:

    2024年02月07日
    瀏覽(17)
  • javaweb個(gè)人主頁(yè)設(shè)計(jì)(html+css+js)

    javaweb個(gè)人主頁(yè)設(shè)計(jì)(html+css+js)

    目錄 1 前言和要求 1.1 前言 1.2 設(shè)計(jì)要求 2 預(yù)覽 2.1 主頁(yè)頁(yè)面 2.2 個(gè)人簡(jiǎn)介 2.3?個(gè)人愛(ài)好 2.4?個(gè)人成績(jī)有代碼,但是圖片已省略,可以根據(jù)自己情況添加 2.5 收藏夾 3 代碼實(shí)現(xiàn)? 3.1 主頁(yè) 3.2 個(gè)人簡(jiǎn)介 3.3 個(gè)人愛(ài)好 3.4 個(gè)人成績(jī)(根據(jù)自己的情況添加) 3.5 收藏夾 4 可能要用的圖片,

    2024年02月09日
    瀏覽(24)

覺(jué)得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請(qǐng)作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包