zoukankan      html  css  js  c++  java
  • 团队冲刺第二十天

    今天做了一下关于天气方面的东西。下面简单展示一下布局和实验代码(主要的问题。是关于github的时间托管问题):

    明天后天。主要看一下自己的那本书(第一行代码)里面有这个天气的项目。对其进行更深的掌握。

    package com.hbweather_2.android;
    
    import android.content.Intent;
    import android.content.SharedPreferences;
    import android.preference.PreferenceManager;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    
    public class MainActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
            SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
            if (prefs.getString("weather", null) != null){
                Intent intent = new Intent(this, WeatherActivity.class);
                startActivity(intent);
                finish();
            }
        }
    }
    <?xml version="1.0" encoding="utf-8"?>
    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
    
        tools:context="com.example.zw.weatherapp.City_history">
        <androidx.Toolbar.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="60dp"
            android:background="#e1dada"
            android:layout_alignParentTop="true"
    
            />
        <RelativeLayout
            android:id="@+id/set"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@+id/toolbar"
    >
            <ImageView
                android:id="@id/icon"
                android:layout_marginTop="8dp"
                android:layout_width="30dp"
                android:layout_height="30dp"
                android:src="@drawable/ic_location_on_black_36dp"
                android:layout_alignParentLeft="true"
    
                />
            <TextView
                android:id="@+id/text_change"
                android:textSize="25dp"
                android:layout_centerInParent="true"
                android:layout_toRightOf="@+id/icon"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="自动定位"/>
            <com.sevenheaven.iosswitch.ShSwitchView
                android:id="@+id/switch_view"
                android:layout_width="80dp"
                android:layout_height="40dp"
                android:layout_alignParentRight="true"
                android:layout_marginRight="10dp"/>
        </RelativeLayout>
    
    
        <ListView
    
            android:id="@+id/listview_city_history"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
    android:layout_below="@+id/set"
            >
    
        </ListView>
        <com.example.zw.weatherapp.AddBtn
            android:id="@+id/btn"
            android:layout_alignParentBottom="true"
            android:layout_width="match_parent"
            android:layout_height="50dp"
    
            />
    </RelativeLayout>

  • 相关阅读:
    第13周作业集
    软件工程结课作业
    第13次作业--邮箱的正则表达式
    第12次作业--你的生日
    第11次作业
    第10次作业
    找回感觉的练习
    第16周作业
    第15周作业
    第14周作业
  • 原文地址:https://www.cnblogs.com/yumazemadui/p/12953248.html
Copyright © 2011-2022 走看看