Skip to content

Commit 067b614

Browse files
committed
sample finish
1 parent e6be6e7 commit 067b614

File tree

24 files changed

+507
-0
lines changed

24 files changed

+507
-0
lines changed

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apply plugin: 'com.android.application'
2+
3+
android {
4+
compileSdkVersion 21
5+
buildToolsVersion "22.0.1"
6+
7+
defaultConfig {
8+
applicationId "lusfold.android_percent_layout_sample"
9+
minSdkVersion 21
10+
targetSdkVersion 22
11+
versionCode 1
12+
versionName "1.0"
13+
}
14+
buildTypes {
15+
release {
16+
minifyEnabled false
17+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
18+
}
19+
}
20+
}
21+
22+
dependencies {
23+
compile fileTree(dir: 'libs', include: ['*.jar'])
24+
compile 'com.android.support:percent:22.2.0'
25+
}

app/proguard-rules.pro

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Add project specific ProGuard rules here.
2+
# By default, the flags in this file are appended to flags specified
3+
# in /Users/bzh/tools/Android/sdk/tools/proguard/proguard-android.txt
4+
# You can edit the include path and order by changing the proguardFiles
5+
# directive in build.gradle.
6+
#
7+
# For more details, see
8+
# http://developer.android.com/guide/developing/tools/proguard.html
9+
10+
# Add any project specific keep options here:
11+
12+
# If your project uses WebView with JS, uncomment the following
13+
# and specify the fully qualified class name to the JavaScript interface
14+
# class:
15+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
16+
# public *;
17+
#}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package lusfold.android_percent_layout_sample;
2+
3+
import android.app.Application;
4+
import android.test.ApplicationTestCase;
5+
6+
/**
7+
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
8+
*/
9+
public class ApplicationTest extends ApplicationTestCase<Application> {
10+
public ApplicationTest() {
11+
super(Application.class);
12+
}
13+
}

app/src/main/AndroidManifest.xml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
package="lusfold.android_percent_layout_sample" >
4+
5+
<application
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:theme="@style/AppTheme" >
10+
<activity
11+
android:name=".MainActivity"
12+
android:label="@string/app_name" >
13+
<intent-filter>
14+
<action android:name="android.intent.action.MAIN" />
15+
16+
<category android:name="android.intent.category.LAUNCHER" />
17+
</intent-filter>
18+
</activity>
19+
</application>
20+
21+
</manifest>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package lusfold.android_percent_layout_sample;
2+
3+
import android.app.Activity;
4+
import android.os.Bundle;
5+
import android.view.Menu;
6+
import android.view.MenuItem;
7+
8+
public class MainActivity extends Activity {
9+
10+
@Override
11+
protected void onCreate(Bundle savedInstanceState) {
12+
super.onCreate(savedInstanceState);
13+
setContentView(R.layout.activity_main);
14+
}
15+
16+
@Override
17+
public boolean onCreateOptionsMenu(Menu menu) {
18+
// Inflate the menu; this adds items to the action bar if it is present.
19+
getMenuInflater().inflate(R.menu.menu_main, menu);
20+
return true;
21+
}
22+
23+
@Override
24+
public boolean onOptionsItemSelected(MenuItem item) {
25+
// Handle action bar item clicks here. The action bar will
26+
// automatically handle clicks on the Home/Up button, so long
27+
// as you specify a parent activity in AndroidManifest.xml.
28+
int id = item.getItemId();
29+
30+
//noinspection SimplifiableIfStatement
31+
if (id == R.id.action_settings) {
32+
return true;
33+
}
34+
35+
return super.onOptionsItemSelected(item);
36+
}
37+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:paddingBottom="@dimen/activity_vertical_margin"
6+
android:paddingLeft="@dimen/activity_horizontal_margin"
7+
android:paddingRight="@dimen/activity_horizontal_margin"
8+
android:paddingTop="@dimen/activity_vertical_margin"
9+
tools:context=".MainActivity">
10+
11+
<android.support.percent.PercentRelativeLayout xmlns:app="http://schemas.android.com/apk/res-auto"
12+
android:layout_width="match_parent"
13+
android:layout_height="match_parent">
14+
15+
<View
16+
android:id="@+id/relative_top"
17+
android:layout_width="0dp"
18+
android:layout_height="0dp"
19+
android:layout_alignParentTop="true"
20+
android:background="#000000"
21+
app:layout_heightPercent="30%"
22+
app:layout_widthPercent="100%" />
23+
24+
<android.support.percent.PercentFrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
25+
xmlns:app="http://schemas.android.com/apk/res-auto"
26+
android:id="@+id/relative_middle"
27+
android:layout_width="0dp"
28+
android:layout_height="0dp"
29+
android:layout_below="@+id/relative_top"
30+
android:background="#0000ff"
31+
app:layout_heightPercent="40%"
32+
app:layout_widthPercent="50%">
33+
34+
<View
35+
android:id="@+id/frame_0"
36+
android:layout_width="0dp"
37+
android:layout_height="0dp"
38+
android:background="#00ffff"
39+
app:layout_heightPercent="25%"
40+
app:layout_widthPercent="75%" />
41+
42+
<View
43+
android:id="@+id/frame_1"
44+
android:layout_width="0dp"
45+
android:layout_height="0dp"
46+
android:background="#ffff00"
47+
app:layout_heightPercent="75%"
48+
app:layout_widthPercent="25%" />
49+
</android.support.percent.PercentFrameLayout>
50+
51+
<View
52+
android:id="@+id/relative_bottom"
53+
android:layout_width="0dp"
54+
android:layout_height="0dp"
55+
android:layout_below="@id/relative_middle"
56+
android:background="#00ff00"
57+
app:layout_heightPercent="30%"
58+
app:layout_widthPercent="100%" />
59+
</android.support.percent.PercentRelativeLayout>
60+
</RelativeLayout>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
3+
<item android:id="@+id/action_settings" android:title="@string/action_settings"
4+
android:orderInCategory="100" android:showAsAction="never" />
5+
</menu>
3.34 KB
Loading
2.15 KB
Loading

0 commit comments

Comments
 (0)