Android Crash Learning

Android Crash Learning,第1张

概述AndroidCrashLearning1.LinearLayout<LinearLayoutxmlns:android="http://schemas.android.com/apkes/android"xmlns:app="http://schemas.android.com/apkes-auto"xmlns:tools="http://schemas.android.comools" AndroID Crash Learning1.linearLayout
<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=".MainActivity">    <TextVIEw        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="Hello World!"        app:layout_constraintBottom_toBottomOf="parent"        app:layout_constraintleft_toleftOf="parent"        app:layout_constraintRight_toRightOf="parent"        app:layout_constrainttop_totopOf="parent" />    <ImageVIEw        androID:layout_wIDth="160dp"        androID:layout_height="90dp"        androID:src="@drawable/react" />    <button        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="按钮" /></linearLayout>
2.relativeLayout
<relativeLayout 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=".MainActivity">    <TextVIEw        androID:layout_margin="50dp"        androID:ID="@+ID/greeting"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="Greeting!"        androID:textSize="50dp"/>    <TextVIEw        androID:layout_margin="50dp"        androID:layout_wIDth="wrap_content"        androID:layout_height="wrap_content"        androID:text="GoodBye!"        androID:layout_below="@+ID/greeting"        androID:textSize="50dp"/></relativeLayout>
3.Toast
Toast.makeText(getApplicationContext(), "哈哈哈", Toast.LENGTH_LONG).show();
4.Click
 public voID btn1(VIEw vIEw) { 	Toast.makeText(getApplicationContext(), "哈哈哈", Toast.LENGTH_LONG).show(); } // 接着设置一下按钮的onClick属性
5.Intent跳转
Intent intent = new Intent(LoginActivity.this, CommonMenuActivity.class);startActivity(intent);

在manifest中需要声明

<activity androID:name=".pages.CommonMenuActivity"></activity>
6.携带数据跳转
// 传输数据Intent intent = new Intent(LoginActivity.this, CommonMenuActivity.class);intent.putExtra("key", "value");// 获取数据Bundle bundle = getIntent().getExtras();bundle.getString("key");// 继承Serializable的对象可以直接intent.putExtra("key", obj);Item item = (Item)bundle.getSerializable("key");
7.API调用
见Github使用Okhttp
总结

以上是内存溢出为你收集整理的Android Crash Learning全部内容,希望文章能够帮你解决Android Crash Learning所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/web/1060709.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存