yygmind


  • Home

  • Categories

  • Archives

  • Tags

  • Search

使用ViewPager和Fragment实现底部导航滑动重构版

Posted on 2016-04-23   |   In Android   |     |   visitors

自定义view

设置每个页面的子item

layout_tab_item.xml,每个item由一个ImageView和一个TextView组成

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
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true">


<ImageView
android:id="@+id/tabImg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true" />


<TextView
android:id="@+id/tabText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tabImg"
android:layout_centerHorizontal="true"
android:text="@string/app_name"
android:textColor="@android:color/white"
android:textSize="16sp" />


</RelativeLayout>

</RelativeLayout>
Read more »

Linux基础入门(1):用户及文件权限管理

Posted on 2016-04-22   |   In Linux   |     |   visitors

一、Linux 用户管理

1、查看用户

1
$ who am i

或者

1
$ who mom likes

输出内容如下

1
yyg      pts/0        2016-04-21 08:28 (:0)
  • 其中第一列表示打开当前伪终端的用户的用户名(可直接使用whoami)
  • 第二列的 pts/0 中 pts 表示伪终端,所谓伪是相对于 /dev/tty 设备而言,即使用 [Ctrl]+[Alt]+[F1]~[F7] 进行切换的 /dev/tty 设备(“真终端”)
  • pts/0后面的0表示伪终端序号,再开一个终端即为1
1
2
3
4
5
6
7
8
9
who 命令其它常用参数

参数 说明
-a 打印能打印的全部
-d 打印死掉的进程
-m 同am i,mom likes
-q 打印当前登录用户数及用户名
-u 打印当前登录用户登录信息
-r 打印运行等级

Read more »

Toast和TextView可能会出现的问题

Posted on 2016-04-21   |   In Android   |     |   visitors

Toast对象可能抛出的Bug

  • Toast对象提供了两个makeText方法,如下
1
2
3
4
5
//此方法传入的是字符串序列
Toast.makeText(Context context, CharSequence text, int duration);

//此方法传入的是资源id
Toast.makeText(Context context, int resId, int duration);
Read more »

细数Android Studio中使用junit4测试框架中的坑

Posted on 2016-04-21   |   In Android   |     |   visitors
  • build.gradle中添加依赖

    1
    2
    3
    4
    dependencies {
    compile 'com.android.support:appcompat-v7:23.2.1'
    testCompile 'junit:junit:4.12'
    }
  • 添加以下,使用模拟环境代替真实环境

    1
    2
    3
    4
    5
    6
    7
    android {
    testOptions {
    unitTests {
    returnDefaultValues = true
    }
    }
    }
Read more »
1…34
yygmind

yygmind

To obsess or to die

34 posts
10 categories
30 tags
github zhihu csdn
© 2016 - 2018 yygmind
Powered by Hexo
Theme - NexT.Muse