now hopefully fixing header/subtitle extra sizing
This commit is contained in:
@@ -27,7 +27,8 @@ public class HeaderSubtitleLinearLayout extends LinearLayout{
|
|||||||
@Override
|
@Override
|
||||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec){
|
||||||
if(getLayoutChildCount()>1){
|
if(getLayoutChildCount()>1){
|
||||||
int remainingWidth=MeasureSpec.getSize(widthMeasureSpec);
|
int fullWidth=MeasureSpec.getSize(widthMeasureSpec);
|
||||||
|
int remainingWidth=fullWidth;
|
||||||
for(int i=1;i<getChildCount();i++){
|
for(int i=1;i<getChildCount();i++){
|
||||||
View v=getChildAt(i);
|
View v=getChildAt(i);
|
||||||
if(v.getVisibility()==GONE)
|
if(v.getVisibility()==GONE)
|
||||||
@@ -36,12 +37,9 @@ public class HeaderSubtitleLinearLayout extends LinearLayout{
|
|||||||
LayoutParams lp=(LayoutParams) v.getLayoutParams();
|
LayoutParams lp=(LayoutParams) v.getLayoutParams();
|
||||||
remainingWidth-=v.getMeasuredWidth()+lp.leftMargin+lp.rightMargin;
|
remainingWidth-=v.getMeasuredWidth()+lp.leftMargin+lp.rightMargin;
|
||||||
}
|
}
|
||||||
if(getChildAt(0) instanceof TextView first){
|
View first=getChildAt(0);
|
||||||
// guaranteeing at least 64sp of width for the display name
|
if(first instanceof TextView){
|
||||||
first.setMaxWidth(Math.max(remainingWidth, V.sp(64)));
|
((TextView) first).setMaxWidth(Math.max(remainingWidth, fullWidth/2));
|
||||||
}
|
|
||||||
if(getChildAt(1) instanceof TextView second){
|
|
||||||
second.setMaxWidth(Math.max(remainingWidth, V.sp(120)));
|
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
View first=getChildAt(0);
|
View first=getChildAt(0);
|
||||||
|
|||||||
Reference in New Issue
Block a user