Android: Using alignBaseline for an image following text

前端 未结 7 2509
独厮守ぢ
独厮守ぢ 2021-02-13 04:35

Below is a TextView followed by an ImageView contained in RelativeLayout. I\'m trying to get the bottom of the image to align with the baseline of the text. When I use alignBa

7条回答
  •  爱一瞬间的悲伤
    2021-02-13 05:29

    /**
     * Set whether to set the baseline of this view to the bottom of the view.
     * Setting this value overrides any calls to setBaseline.
     *
     * @param aligned If true, the image view will be baseline aligned with
     *      based on its bottom edge.
     *
     * @attr ref android.R.styleable#ImageView_baselineAlignBottom
     */
    public void setBaselineAlignBottom(boolean aligned) {
        if (mBaselineAlignBottom != aligned) {
            mBaselineAlignBottom = aligned;
            requestLayout();
        }
    }
    

提交回复
热议问题