forked from hongyangAndroid/AndroidAutoLayout
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hongyangAndroid
committed
Nov 20, 2015
1 parent
002b005
commit c514e14
Showing
8 changed files
with
165 additions
and
64 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
sample/src/main/java/com/zhy/sample/AutoLayoutActivity.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.zhy.sample; | ||
|
||
import android.content.Context; | ||
import android.support.v7.app.AppCompatActivity; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
|
||
import zhy.com.autolayout.AutoFrameLayout; | ||
import zhy.com.autolayout.AutoLinearLayout; | ||
import zhy.com.autolayout.AutoRelativeLayout; | ||
|
||
; | ||
|
||
/** | ||
* Created by zhy on 15/11/19. | ||
*/ | ||
public class AutoLayoutActivity extends AppCompatActivity | ||
{ | ||
private static final String LAYOUT_LINEARLAYOUT = "LinearLayout"; | ||
private static final String LAYOUT_FRAMELAYOUT = "FrameLayout"; | ||
private static final String LAYOUT_RELATIVELAYOUT = "RelativeLayout"; | ||
|
||
@Override | ||
public View onCreateView(String name, Context context, AttributeSet attrs) | ||
{ | ||
View view = null; | ||
if (name.equals(LAYOUT_FRAMELAYOUT)) | ||
{ | ||
view = new AutoFrameLayout(context, attrs); | ||
} | ||
|
||
if (name.equals(LAYOUT_LINEARLAYOUT)) | ||
{ | ||
view = new AutoLinearLayout(context, attrs); | ||
} | ||
|
||
if (name.equals(LAYOUT_RELATIVELAYOUT)) | ||
{ | ||
view = new AutoRelativeLayout(context, attrs); | ||
} | ||
|
||
if (view != null) return view; | ||
|
||
|
||
return super.onCreateView(name, context, attrs); | ||
} | ||
|
||
|
||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,134 @@ | ||
<zhy.com.autolayout.AutoFrameLayout | ||
<zhy.com.autolayout.AutoLinearLayout | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
xmlns:app="http://schemas.android.com/apk/res-auto" | ||
xmlns:tools="http://schemas.android.com/tools" | ||
android:layout_width="match_parent" | ||
android:layout_height="match_parent" | ||
android:background="#AAcccccc" | ||
android:orientation="vertical" | ||
tools:context=".MainActivity"> | ||
|
||
<zhy.com.autolayout.AutoLinearLayout | ||
android:orientation="horizontal" | ||
<zhy.com.autolayout.AutoRelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="wrap_content" | ||
android:layout_gravity="center" | ||
app:layout_auto_height="180" | ||
android:layout_height="86px" | ||
android:layout_marginTop="26px" | ||
android:background="#ffffffff" | ||
> | ||
|
||
<ImageView | ||
android:id="@+id/id_tv_add" | ||
android:layout_width="34px" | ||
android:layout_height="34px" | ||
android:layout_gravity="center_vertical" | ||
android:layout_marginLeft="276px" | ||
android:layout_marginTop="26px" | ||
android:src="@mipmap/add" | ||
/> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_auto_height="180" | ||
android:background="#44ff0000" | ||
app:layout_auto_width="180" | ||
android:layout_centerVertical="true" | ||
android:layout_marginLeft="26px" | ||
android:layout_toRightOf="@id/id_tv_add" | ||
android:text="新增旅客" | ||
android:textColor="#1fb6c4" | ||
android:textSize="32px" | ||
/> | ||
|
||
|
||
</zhy.com.autolayout.AutoRelativeLayout> | ||
|
||
|
||
<zhy.com.autolayout.AutoRelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="108px" | ||
android:layout_marginTop="26px" | ||
android:background="#ffffffff" | ||
> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_auto_height="180" | ||
app:layout_auto_width="180" | ||
android:background="#86fcff" | ||
android:layout_marginLeft="22px" | ||
android:layout_marginTop="16px" | ||
android:text="王大炮 WANG.DAPAO" | ||
android:textColor="#333" | ||
android:textSize="28px" | ||
/> | ||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_marginBottom="16px" | ||
android:layout_marginLeft="22px" | ||
android:text="护照:G50786449" | ||
android:textColor="#999" | ||
android:textSize="26px" | ||
/> | ||
|
||
</zhy.com.autolayout.AutoRelativeLayout> | ||
|
||
<zhy.com.autolayout.AutoRelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="108px" | ||
android:layout_marginTop="26px" | ||
android:background="#ffffffff" | ||
> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_auto_height="180" | ||
android:background="#ea91ff" | ||
app:layout_auto_width="180" | ||
android:layout_marginLeft="22px" | ||
android:layout_marginTop="16px" | ||
android:text="王大炮 WANG.DAPAO" | ||
android:textColor="#333" | ||
android:textSize="28px" | ||
/> | ||
|
||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
app:layout_auto_height="180" | ||
android:background="#3989ff" | ||
app:layout_auto_width="180" | ||
android:layout_alignParentBottom="true" | ||
android:layout_marginBottom="16px" | ||
android:layout_marginLeft="22px" | ||
android:text="护照:G50786449" | ||
android:textColor="#999" | ||
android:textSize="26px" | ||
/> | ||
|
||
</zhy.com.autolayout.AutoRelativeLayout> | ||
|
||
<zhy.com.autolayout.AutoRelativeLayout | ||
android:layout_width="match_parent" | ||
android:layout_height="108px" | ||
android:layout_marginTop="26px" | ||
android:background="#ffffffff" | ||
> | ||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_marginLeft="22px" | ||
android:layout_marginTop="16px" | ||
android:text="王大炮 WANG.DAPAO" | ||
android:textColor="#333" | ||
android:textSize="28px" | ||
/> | ||
|
||
|
||
<TextView | ||
android:layout_width="wrap_content" | ||
android:layout_height="wrap_content" | ||
android:layout_alignParentBottom="true" | ||
android:layout_marginBottom="16px" | ||
android:layout_marginLeft="22px" | ||
android:text="护照:G50786449" | ||
android:textColor="#999" | ||
android:textSize="26px" | ||
/> | ||
|
||
</zhy.com.autolayout.AutoLinearLayout> | ||
</zhy.com.autolayout.AutoRelativeLayout> | ||
|
||
|
||
</zhy.com.autolayout.AutoFrameLayout> | ||
</zhy.com.autolayout.AutoLinearLayout> |
This file was deleted.
Oops, something went wrong.