private void updateTitleBottomPadding() { if (isIconsOnlyMode()) { return; } int tabCount = getTabCount(); if (tabContainer == null || tabCount == 0 || !isShiftingMode()) { return; } for (int i = 0; i < tabCount; i++) { BottomBarTab tab = getTabAtPosition(i); TextView title = tab.getTitleView(); if (title == null) { continue; } int baseline = title.getBaseline(); int height = title.getHeight(); int paddingInsideTitle = height - baseline; int missingPadding = tenDp - paddingInsideTitle; if (missingPadding > 0) { title.setPadding(title.getPaddingLeft(), title.getPaddingTop(), title.getPaddingRight(), missingPadding + title.getPaddingBottom()); } } }
int base = mParent.getBaseline(); int[] stateSet = getState();
data.put("Baseline", tv.getBaseline()); data.put("EditableText", String.valueOf(tv.getEditableText())); data.put("Error", String.valueOf(tv.getError()));
final int currRight = currLeft + currWidth; final int prevBaseline = mPrevText.getBaseline(); final int currBaseline = mCurrText.getBaseline(); final int nextBaseline = mNextText.getBaseline(); final int maxBaseline = Math.max(Math.max(prevBaseline, currBaseline), nextBaseline); final int prevTopOffset = maxBaseline - prevBaseline;
final int currRight = currLeft + currWidth; final int prevBaseline = mPrevText.getBaseline(); final int currBaseline = mCurrText.getBaseline(); final int nextBaseline = mNextText.getBaseline(); final int maxBaseline = Math.max(Math.max(prevBaseline, currBaseline), nextBaseline); final int prevTopOffset = maxBaseline - prevBaseline;
@Test @FlakyTest(tolerance = TOLERANCE) public void testAlignItems_baseline() throws Throwable { final FlexboxTestActivity activity = mActivityRule.getActivity(); mActivityRule.runOnUiThread(new Runnable() { @Override public void run() { activity.setContentView(R.layout.activity_align_items_baseline_test); } }); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); TextView textView1 = (TextView) activity.findViewById(R.id.text1); TextView textView2 = (TextView) activity.findViewById(R.id.text2); TextView textView3 = (TextView) activity.findViewById(R.id.text3); int topPluBaseline1 = textView1.getTop() + textView1.getBaseline(); int topPluBaseline2 = textView2.getTop() + textView2.getBaseline(); int topPluBaseline3 = textView3.getTop() + textView3.getBaseline(); assertThat(topPluBaseline1, is(topPluBaseline2)); assertThat(topPluBaseline2, is(topPluBaseline3)); }
@Test @FlakyTest(tolerance = TOLERANCE) public void testAlignItems_baseline_wrapReverse() throws Throwable { final FlexboxTestActivity activity = mActivityRule.getActivity(); mActivityRule.runOnUiThread(new Runnable() { @Override public void run() { activity.setContentView(R.layout.activity_align_items_baseline_test); FlexboxLayout flexboxLayout = (FlexboxLayout) activity .findViewById(R.id.flexbox_layout); flexboxLayout.setFlexWrap(FlexboxLayout.FLEX_WRAP_WRAP_REVERSE); } }); InstrumentationRegistry.getInstrumentation().waitForIdleSync(); TextView textView1 = (TextView) activity.findViewById(R.id.text1); TextView textView2 = (TextView) activity.findViewById(R.id.text2); TextView textView3 = (TextView) activity.findViewById(R.id.text3); int bottomPluBaseline1 = textView1.getBottom() + textView1.getBaseline(); int bottomPluBaseline2 = textView2.getBottom() + textView2.getBaseline(); int bottomPluBaseline3 = textView3.getBottom() + textView3.getBaseline(); assertThat(bottomPluBaseline1, is(bottomPluBaseline2)); assertThat(bottomPluBaseline2, is(bottomPluBaseline3)); }