Skip to content

Commit

Permalink
TextView
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaLei123 committed May 24, 2016
1 parent 6bbce59 commit 336e968
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This is the Jia Lei Andriod learn project

Structure
------------------------
There is only one mainactive, but each chapter has one package to include all example for it.
There is only one **MainActivity**, but each chapter has one package to include all example Activity for it.
the it can to change the manifests to let the app to show which example

>**Note**
Expand Down
7 changes: 4 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"

defaultConfig {
applicationId "com.example.jiayu.helloworld"
minSdkVersion 15
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
Expand All @@ -17,10 +16,12 @@ android {
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
</intent-filter>
</activity>
-->
<activity android:name=".Chapter2.Chapter2TextView">
<activity android:name=".Chapter2.Chapter2TextView2">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.example.jiayu.helloworld.Chapter2;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import com.example.jiayu.helloworld.R;

public class Chapter2TextView2 extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_chapter2_text_view2);
}
}
5 changes: 5 additions & 0 deletions app/src/main/res/drawable/bg_border.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#0000"/>
<stroke android:width="4px" android:color="#f00"/>
</shape>
12 changes: 12 additions & 0 deletions app/src/main/res/drawable/bg_border2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:topLeftRadius="20px"
android:topRightRadius="5px"
android:bottomRightRadius="20px"
android:bottomLeftRadius="5px"/>
<stroke android:width="4px" android:color="#f0f"/>
<gradient android:startColor="#f00"
android:centerColor="#0f0"
android:endColor="#00f"
android:type="linear"/>
</shape>
35 changes: 32 additions & 3 deletions app/src/main/res/layout/activity_chapter2_text_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,44 @@
android:singleLine="true"
android:text="我爱java"
android:textSize="20pt"
android:drawableEnd="@drawable/virtual_pc"
android:drawableRight="@drawable/virtual_pc"/>
android:drawableEnd="@drawable/virtual_pc"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text=""/>
android:text="我爱java我爱java我爱java我爱java我爱java我爱java"
android:ellipsize="middle"
android:textAllCaps="true"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:singleLine="true"
android:text="邮件是[email protected], 电话是(123)4567822"
android:autoLink="email|phone"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="测试文字"
android:shadowColor="#00f"
android:shadowDx="10.0"
android:shadowDy="8.0"
android:shadowRadius="3.0"
android:textColor="#f00"
android:textSize="30pt"/>

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="password"
android:password="true"/>

<CheckedTextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="克勾选的文本"
android:checkMark="@drawable/button_ok"/>

</LinearLayout>
20 changes: 20 additions & 0 deletions app/src/main/res/layout/activity_chapter2_text_view2.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">

<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="带边框的文本"
android:textSize="24pt"
android:background="@drawable/bg_border"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="圆角边框,渐变背景的文本"
android:textSize="24pt"
android:background="@drawable/bg_border2"/>

</LinearLayout>

0 comments on commit 336e968

Please sign in to comment.