Skip to content Skip to sidebar Skip to footer

Getbaseline Of Textview Returns -1

I am trying to align two TextView one is inside HorizontalScrollView, and both are children of LinerLayout . When I am trying to call getBaseLine of TextView inside onWindowAttache

Solution 1:

View is not measured when onViewAttachedToWindow is called, hence it is returning -1.

Better approach would be.

@OverridepublicvoidonBindViewHolder(RecyclerView.ViewHolder holder, int position)
    {
        .
        .
        .
        viewHolder.itemView.post(newRunnable()
                {

                   //put your code here

Post a Comment for "Getbaseline Of Textview Returns -1"