Hero Section UI Stability
This skill documents the layout and animation standards to prevent flickering and layout jitters in high-impact Hero sections.
Layout Constraints
- •Width Management: Hero amount
TextViews MUST useandroid:layout_width="match_parent"instead ofwrap_contentto prevent the card from recalculating its center or width during numeric transitions. - •Line Control: Always set
android:maxLines="1"andandroid:ellipsize="end"to guarantee vertical stability. - •Auto-Scaling Typography: Use Material 3 auto-sizing to handle varying currency lengths and massive amounts:
xml
app:autoSizeTextType="uniform" app:autoSizeMinTextSize="24sp" app:autoSizeMaxTextSize="45sp"
Animation Stability
- •Decimal Preservation: During count-up animations, the logic MUST determine if the target value has decimals and maintain that decimal count throughout the animation. Flashing from
120to120.4to121causes horizontal jittering and MUST be avoided. - •Formatting Parity: Every frame of an animation must re-apply the 50% smaller symbol and standard spacing through
SpannableStringBuilderto ensure a smooth, coherent transition.
Performance Checklist
- • Is the TextView wider than the largest possible value?
- • Does the text shrink to fit without wrapping?
- • Are decimal places stable during animation?
- • Is the currency symbol consistently smaller than the numbers?