1 package com.android.systemui.qs; 2 3 import android.content.Context; 4 import android.util.AttributeSet; 5 import android.view.Gravity; 6 import android.view.View; 7 import android.view.ViewGroup; 8 import android.widget.LinearLayout; 9 10 public class QuickTileLayout extends LinearLayout { 11 QuickTileLayout(Context context)12 public QuickTileLayout(Context context) { 13 this(context, null); 14 } 15 QuickTileLayout(Context context, AttributeSet attrs)16 public QuickTileLayout(Context context, AttributeSet attrs) { 17 super(context, attrs); 18 setGravity(Gravity.CENTER); 19 } 20 21 @Override addView(View child, int index, ViewGroup.LayoutParams params)22 public void addView(View child, int index, ViewGroup.LayoutParams params) { 23 // Make everything square at the height of this view. 24 params = new LayoutParams(params.height, params.height); 25 ((LinearLayout.LayoutParams) params).weight = 1; 26 super.addView(child, index, params); 27 } 28 } 29