
Android
So_Band
冲呀!!!!
展开
-
Android studio 的真机测试
首先你要安装Android studio 这个软件,网上有安装和配置,我是已经死了的。如果需要打开模拟器,就下载相应的安卓系统。需要连接SDK中的 SDK—–>latform-tools将此进行环境变量的配置 在命令行中运行adb devices 进行连接 在Android studio上进行USB设置 直接应用在手机上调节将设置开发者模式,然后连接手机,在PC机子上...原创 2018-07-25 18:05:31 · 295 阅读 · 0 评论 -
RecyclerView的使用
RecyclerView的功能要比ListView的功能强大,它可以排列的方式更为多。 运用方式: 首先在 app/build.gradle文件中添加代码,上一篇博客中有写。 首先我们创建一个水果的类 public class Fruit { private String name; private int imageId; public Fruit(Str...原创 2018-08-02 18:32:09 · 234 阅读 · 0 评论 -
RecyclerView的版本与APPcompat的版本必须一样
RecyclerView的版本与APPcompat的版本不一样的时候且也没有这个版本的时候,看版本在SDK,D:\Android\Sdk\extras\android\m2repository\com\android\support\recyclerview-v7中看 在dependencies中将RecyclerView 的代码改为 implementation ‘com.android.s...原创 2018-08-01 22:08:19 · 3580 阅读 · 2 评论 -
模拟QQ聊天记录界面 RecyclerView
首先,在build.gradle中添加函数依赖库。 编辑主界面。 <《》LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” xmlns:tools=”http://schem...原创 2018-08-05 18:29:22 · 1113 阅读 · 0 评论 -
在Android studio中设置Nine-Path的图片
必须为png格式,将图片放入drawable中,右键,create 9-patch可以编辑,编辑好之后,删除原来的,保存.9.png格式的图片就可以了。原创 2018-08-05 18:17:21 · 687 阅读 · 0 评论 -
Intent 来进行活动之间的传递
在一个项目中创建第二个活动 在java中com.example.activityes包中点击new,Acitvity—-&amp;gt;Empty Activity来创建一个新的活动 不要勾选Launcher Activity这个,这个是设置是否为主活动。创建好第二个活动之后,Android studio会在AndroidManifest.xml自动生成新建好的活动的activity的标签显示I...原创 2018-07-27 21:38:37 · 282 阅读 · 0 评论 -
定制ListView界面,有关其事件
设置ListView的界面 新建一个fruit_item.xml布局。 代码如下 <《》LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:orientation=”vertical” android:layout_width=”match_pare...原创 2018-07-31 18:48:47 · 308 阅读 · 0 评论 -
最常用和最难用ListView控件
在布局中加入控件 <《》ListView android:id=”@+id/list_view” android:layout_width=”match_parent” android:layout_height=”match_parent”> <《》/ListView> 在主代码中进行显示...原创 2018-07-31 18:23:55 · 304 阅读 · 0 评论 -
线性布局和相对布局
线性布局:LinearLayout Android:orientation=“vertical”//定义为垂直排列控件 Android:orientation=“horizontal”//将控件定义为水平排列 当将活动定义为水平排列的时候 一个控件的其中属性为: android:layout_width=”0dp” android:layout_weight=”2” 另外一个控件为其...原创 2018-07-31 13:26:48 · 546 阅读 · 0 评论 -
创建自定义控件
新建一个Title.xml布局 将需要的控件写进去。在主布局中改为如下代码 <《》LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” android:layout_width=”match_parent” android:layout_height=”match_paren...原创 2018-07-31 13:14:58 · 163 阅读 · 0 评论 -
Android 常用组件,的常用类型
全部都是定义在布局中。TextView: android:gravity=”center|bottom”//来设置位置,其中|为定义多值。分别有top,bottom,left,right,center等 android:textSize=”20sp”//来设置字体大小,sp为单位。 android:textColor=”@android:color/holo_red_dark”//来...原创 2018-07-30 15:42:27 · 762 阅读 · 0 评论 -
layout_wdith和layout_height
layout_wdith = match_parent//表示让当前的元素和父元素一样宽 layout_height = wrap_content //表示当前的元素的高度只要刚好包含里面的内容就行。原创 2018-07-30 13:55:07 · 302 阅读 · 0 评论 -
添加两个按钮进行显示
<《》LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android” xmlns:app=”http://schemas.android.com/apk/res-auto” android:orientation=”vertical”在主活动中添加此行代码就可以将组件设置为垂直排列。...原创 2018-07-29 20:31:49 · 421 阅读 · 0 评论 -
活动的启动的模式
在实际项目中,我们应该根据特定的需求为每一个活动指定恰当的启动模式。 在AndroidManifest.xml中通过<《activity>标签中指定。如下 <《》activity android:name=”.SecondActivity” android:launchMode=”singleInstance”> 在...原创 2018-07-29 20:06:34 · 248 阅读 · 0 评论 -
通过Intent,向下活动传递数据,向上活动传递数据,当按下收集返回按钮时返回的数据
向下一个活动传递数据 在第一个活动中的代码输入: 在一个按钮事件中 String data =”hello World!”; Intent intent = new Intent(FirstActivity.this,SecondActivity.class); intent.putExtra(“extra_data”,data); ...原创 2018-07-28 22:36:29 · 485 阅读 · 0 评论 -
隐式活动Intent的用法
通过隐式活动可以通过一个事件打开一个连接和一个电话号码 在一个按钮监听里输入代码:打开一个连接 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setData(Uri.parse(“http://www.baidu.com“)); startActivity(intent);Int...原创 2018-07-28 22:08:36 · 286 阅读 · 0 评论 -
Android 中的活动,手动创建活动,添加按钮,使用Toast
活动:是一种可以包含用户界面的组件,主要用于和用户之间交互网上有手动创建活动的内容只要是创建和加载布局 添加一个按钮:在res—>layout first_layout.xml上加入按钮 如下代码<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:...原创 2018-07-25 20:01:38 · 1217 阅读 · 1 评论 -
RecyclerView中的水平滑动,瀑布流布局
设置fruit_Item.xml中的排列方式为垂直,宽度为100dp,如果宽度设置为match_parent的话,子项将会占满了整个屏幕。 再讲TextView中的属性设置为 android:layout_marginTop=”10dp”//表示两者之间的距离。并且图片和文字的属性都设置为 android:layout_gravity=”center_horizonta...原创 2018-08-02 19:05:25 · 603 阅读 · 0 评论