List of usage examples for android.widget TextView getBottom
@ViewDebug.CapturedViewProperty public final int getBottom()
From source file:Main.java
public static boolean drawDrawables(Canvas canvas, @Nonnull TextView textView) { final int compoundPaddingLeft = textView.getCompoundPaddingLeft(); final int compoundPaddingTop = textView.getCompoundPaddingTop(); final int compoundPaddingRight = textView.getCompoundPaddingRight(); final int compoundPaddingBottom = textView.getCompoundPaddingBottom(); final int scrollX = textView.getScrollX(); final int scrollY = textView.getScrollY(); final int right = textView.getRight(); final int left = textView.getLeft(); final int bottom = textView.getBottom(); final int top = textView.getTop(); final Drawable[] drawables = textView.getCompoundDrawables(); if (drawables != null) { int vspace = bottom - top - compoundPaddingBottom - compoundPaddingTop; int hspace = right - left - compoundPaddingRight - compoundPaddingLeft; Drawable topDr = drawables[1];// w w w .j ava 2 s.c o m // IMPORTANT: The coordinates computed are also used in invalidateDrawable() // Make sure to update invalidateDrawable() when changing this code. if (topDr != null) { canvas.save(); canvas.translate(scrollX + compoundPaddingLeft + (hspace - topDr.getBounds().width()) / 2, scrollY + textView.getPaddingTop() + vspace / 2); topDr.draw(canvas); canvas.restore(); return true; } } return false; }
From source file:com.timothy.android.api.fragment.LeftFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { final View view = inflater.inflate(R.layout.left_list, null); title = (TextView) view.findViewById(R.id.indexTV); int branchIndex = SPUtil.getIntegerFromSP(SPUtil.CURRENT_BRANCH_INDEX, sp); if (branchIndex != -1 && branchNames != null) { title.setText(branchNames[branchIndex - 1]); }//w w w. j a v a2s . co m title.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View arg0) { TextView tv = (TextView) arg0; if (view.getVisibility() == View.VISIBLE && tv.getVisibility() == View.VISIBLE) { if (branchNames != null && branchNames.length > 0) { tv.getTop(); int y = tv.getBottom() * 3 / 2; int x = tv.getLeft(); // int x = activity.getWindowManager().getDefaultDisplay().getWidth() / 4; showPopupWindow(x, y); } } } }); return view; }
From source file:chat.client.gui.ChatActivity.java
private void scrollDown() { final ScrollView scroller = (ScrollView) findViewById(R.id.scroller); final TextView chatField = (TextView) findViewById(R.id.chatTextView); scroller.smoothScrollTo(0, chatField.getBottom()); }
From source file:com.android.tv.menu.MenuLayoutManager.java
private void setTempTitleView(TextView dest, TextView src) { dest.setVisibility(View.VISIBLE); dest.setText(src.getText());/*from ww w.ja v a2 s . c o m*/ dest.setTranslationY(0.0f); if (src.getVisibility() == View.VISIBLE) { dest.setAlpha(src.getAlpha()); dest.setScaleX(src.getScaleX()); dest.setScaleY(src.getScaleY()); } else { dest.setAlpha(0.0f); dest.setScaleX(1.0f); dest.setScaleY(1.0f); } View parent = (View) src.getParent(); dest.setLeft(src.getLeft() + parent.getLeft()); dest.setRight(src.getRight() + parent.getLeft()); dest.setTop(src.getTop() + parent.getTop()); dest.setBottom(src.getBottom() + parent.getTop()); }