积跬步

Just do IT Now.


  • Home

  • Tags

  • Categories

  • Archives

  • Search

UI-CheckBox

Posted on 2020-04-07 | In Android

CheckBox

一个ImageView实现CheckBox功能

定义ImageView布局控件

Read more »

Dialog相关

Posted on 2020-04-07 | In Android

Dialog相关

自定义布局的Dialog

基类dialog

Read more »

UI-FloatingActionButton

Posted on 2020-04-07 | In Android

Android自定义的FloatingActionButton效果

现在Android的ActionBar功能已经很少人app使用了。但是有些页面还是需要这种按钮的操作(比如执行一些数据刷新或页面跳转的功能),就有了现在的悬浮效果的按钮,并且这个悬浮按钮可以设置在页面的任意位置!其实就是一个ImageButton,经过各种封装和处理后得到一个比较好看的效果。

现在谷歌官方的Design包,已经右有FloatingActionButton这个类了,但是要求版本较高,所有现在很多编译器没法使用,我的也是,这里使用的是自定义的类。具体代码可以看源码,只有几个类,但是要添加一些资源文件。很多具体的属性可以自己修改。

Read more »

UI-LoadingBar

Posted on 2020-04-07 | In Android

LoadingBar

效果图

LoadingBar效果图

Read more »

UI-TextView相关

Posted on 2020-04-07 | In Android

TextView

TV内容过长,显示省略号

TextView中有个ellipsize属性,作用是当文字过长时,该控件该如何显示,解释如下:

Read more »

UI-Toast

Posted on 2020-04-07 | In Android

ToastUtils

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.Gravity;
import android.widget.Toast;

public class ToastUtils {
private static Toast sToast;


private ToastUtils() {

}

public static void showToast(Context context, String text) {
showToastInner(context, text, Toast.LENGTH_SHORT);
}

public static void showToast(Context context, int stringId) {
showToastInner(context, context.getString(stringId), Toast.LENGTH_SHORT);
}


public static void showToastLong(Context context, String text) {
showToastInner(context, text, Toast.LENGTH_LONG);
}

public static void showToastLong(Context context, int stringId) {
showToastInner(context, context.getString(stringId), Toast.LENGTH_LONG);
}

private static void showToastInner(Context context, String text, int duration) {
ensureToast(context);
sToast.setText(text);
//居中显示
sToast.setGravity(Gravity.CENTER, 0, 0);
//显示时长
sToast.setDuration(duration);
sToast.show();
}


@SuppressLint("ShowToast")
private static void ensureToast(Context context) {
if (sToast != null) {
return;
}
synchronized (ToastUtils.class) {
if (sToast != null) {
return;
}
sToast = Toast.makeText(context.getApplicationContext(), " ", Toast.LENGTH_SHORT);
}
}
}

居中显示带自定义布局

Read more »

UI-引导层

Posted on 2020-04-07 | In Android代码片段

引导层错位问题解决

image-20210219103102195

在今天修复燕谷坊的Bug过程中,发现了这样一个问题:在APP的实现过程中常常有这样一个功能,当用户第一次使用app的时候部分界面会弹出新手引导蒙版来告知用户具体的功能和操作;在燕谷坊导购端中也是用了这样的一个功能,但是它的实现方式是在界面上直接套上一个静态面板,这样实现起来方便快捷 ,但是会出现比较严重的适配问题,在不同的分辨率的手机上会出现严重的错位问题,因此需要舍弃旧的方案,采用适配性更强的方案,这里是采用第三方开源框架来实现的(NewGuide),

Read more »

UI-搜索框带俩页签

Posted on 2020-04-07 | In Android代码片段

搜索框带俩页签

效果图

搜索带两页签.gif

Read more »

日期选择PickerView

Posted on 2020-04-07 | In Android代码片段

日期选择PickerView

app/build.gradle

1
2
3
4
5
dependencies{
//...
/** PickerView控件,有时间选择器和选项选择器,3D滚轮效果 */
compile 'com.contrarywind:Android-PickerView:4.1.9'
}
Read more »

UI-系统桌面

Posted on 2020-04-07 | In Android代码片段

Android实现无界面无图标App最简单的方式

  1. AndroidManifest.xml中,去掉category标签
1
2
3
4
5
6
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<!--<category android:name="andorid.intent.category.LAUNCHER"/>-->
</intent-filter>
</activity>
Read more »

功能-免Root静默安装

Posted on 2020-04-07 | In Android代码片段

免Root静默安装

实现原理:在PC上运行一Java程序,建立socket服务器与app通信,远程执行app下发的代码。「并不是给 app 提权,而是运行了一个有 shell 权限的新程序」

Tips:需要USB连着PC,实现免Root点击任意位置或静默安装。

Read more »

功能-分享

Posted on 2020-04-07 | In Android代码片段

分享到自己的app

创建俩app,一个app发送,一个app接收

接收的app

Read more »
<1…151617…23>

276 posts
23 categories
47 tags
E-Mail CSDN
0%
© 2018 — 2025 阿炳
Powered by Hexo
|
Theme — NexT.Gemini v5.1.4