improve login layout

This commit is contained in:
Phillip Thelen 2017-04-17 13:45:02 +02:00
parent 991c0967e3
commit 5d7ccd04cd
2 changed files with 11 additions and 9 deletions

View file

@ -33,7 +33,7 @@
android:layout_height="0dp"
android:layout_centerHorizontal="true"
android:visibility="invisible"
android:layout_below="@id/city_view" />
android:layout_above="@id/city_view" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@ -41,10 +41,9 @@
android:id="@+id/left_cloud_view"
android:layout_toLeftOf="@id/cloud_anchor"
android:layout_marginRight="150dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:layout_marginTop="150dp"
android:paddingBottom="460dp"
/>
<ImageView
android:layout_width="wrap_content"
@ -53,10 +52,9 @@
android:id="@+id/right_cloud_view"
android:layout_toRightOf="@id/cloud_anchor"
android:layout_marginLeft="170dp"
android:layout_below="@id/cloud_anchor"
android:layout_alignParentLeft="false"
android:layout_alignParentBottom="true"
android:scaleType="centerCrop"
android:layout_marginTop="240dp"
android:paddingBottom="400dp"
/>

View file

@ -39,6 +39,7 @@ public class LoginBackgroundView extends RelativeLayout {
private int width;
private int height;
private boolean didLayoutStars = false;
private FrameLayout.LayoutParams params;
public LoginBackgroundView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
@ -50,6 +51,7 @@ public class LoginBackgroundView extends RelativeLayout {
super.onFinishInflate();
ButterKnife.bind(this, this);
starViews = new ArrayList<>();
params = new FrameLayout.LayoutParams(0, 0);
generateStars();
animateClouds();
}
@ -72,7 +74,9 @@ public class LoginBackgroundView extends RelativeLayout {
this.width = parentWidth;
this.height = (int)(parentHeight*SIZE_FACTOR);
this.setMeasuredDimension(width, height);
this.setLayoutParams(new FrameLayout.LayoutParams(width, height));
params.width = width;
params.height = height;
this.setLayoutParams(params);
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
@ -83,7 +87,7 @@ public class LoginBackgroundView extends RelativeLayout {
}
public void generateStars() {
generateStars(1, 10, 20);
generateStars(1, 12, 25);
}
private void generateStars(int largeCount, int mediumCount, int smallCount) {