remove the margins around the calendar widget

This commit is contained in:
tibbi 2016-01-31 17:25:46 +01:00
parent 1050d9c0d2
commit 53a3c76299
2 changed files with 8 additions and 1 deletions

View File

@ -5,6 +5,8 @@ import android.graphics.Color;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AppCompatActivity; import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
@ -21,8 +23,10 @@ public class MainActivity extends AppCompatActivity implements MyDatePickerDialo
@Bind(R.id.left_arrow) ImageView leftArrow; @Bind(R.id.left_arrow) ImageView leftArrow;
@Bind(R.id.right_arrow) ImageView rightArrow; @Bind(R.id.right_arrow) ImageView rightArrow;
@Bind(R.id.table_month) TextView monthTV; @Bind(R.id.table_month) TextView monthTV;
@Bind(R.id.calendar_holder) View calendarHolder;
@BindDimen(R.dimen.day_text_size) float dayTextSize; @BindDimen(R.dimen.day_text_size) float dayTextSize;
@BindDimen(R.dimen.today_text_size) float todayTextSize; @BindDimen(R.dimen.today_text_size) float todayTextSize;
@BindDimen(R.dimen.activity_margin) int activityMargin;
private CalendarImpl calendar; private CalendarImpl calendar;
private Resources res; private Resources res;
@ -47,6 +51,9 @@ public class MainActivity extends AppCompatActivity implements MyDatePickerDialo
todayTextSize /= res.getDisplayMetrics().density; todayTextSize /= res.getDisplayMetrics().density;
setupLabels(); setupLabels();
final FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) calendarHolder.getLayoutParams();
params.setMargins(activityMargin, activityMargin, activityMargin, activityMargin);
calendar = new CalendarImpl(this); calendar = new CalendarImpl(this);
calendar.updateCalendar(new DateTime()); calendar.updateCalendar(new DateTime());
} }

View File

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout <RelativeLayout
android:id="@+id/calendar_holder"
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="@dimen/activity_margin"
tools:context="calendar.simplemobiletools.com.MainActivity"> tools:context="calendar.simplemobiletools.com.MainActivity">
<ImageView <ImageView