Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextView自动换行了 #30

Open
BlackC0 opened this issue Jan 26, 2021 · 20 comments
Open

TextView自动换行了 #30

BlackC0 opened this issue Jan 26, 2021 · 20 comments

Comments

@BlackC0
Copy link

BlackC0 commented Jan 26, 2021

默认状态下 箭头处于正中间
似乎由于箭头到右侧的距离不够 但箭头设置在最中间
所以为了保证他在中间 计算了左侧距离等于右侧距离 相加等于总距离
但是这个总距离不够我显示所有文字 于是TextView换行了
这个设计不是不行 但是不是能够更加智能化呢?
对于气泡提示来说 箭头是否是在正中间无所谓 只要位置出现的是指定的地方就可以了
再屏幕的距离能够满足的情况下 是否能够箭头自适应呢?

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

image
箭头这是在对应控件的中间,不一定在气泡的中,你说的是这种情况吗?
能否截图一下你当前的情况呢?

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

微信图片_20210126174341
设备无法截图,分辨率可能不高

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

BubbleLayout bl = new BubbleLayout(mActivity);
bl.setBubbleColor(Color.parseColor("#333333"));
bl.setBubbleRadius(Util.dpToPx(mActivity, 3));

            new BubbleDialog(mActivity)
                    .setBubbleContentView(LayoutInflater.from(mActivity).inflate(R.layout.dialog, null))
                    .setClickedView(paySettingFragment_imageView_tips)
                    .setPosition(BubbleDialog.Position.BOTTOM)
                    .setOffsetY(mActivity.getResources().getDimensionPixelOffset(R.dimen.y30))
                    .setBubbleLayout(bl)
                    .show();

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

看看你的布局怎么写的呢

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

图片

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

你试试给TextView加上singleLine试试

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

箭头的朝向是一个
箭头的位置是不是也可以做一个状态常量呢
比如start,end,center,auto

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

测试过 会出现部分文字显示不出来

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

我用的是maxline = 1

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

箭头的朝向是一个
箭头的位置是不是也可以做一个状态常量呢
比如start,end,center,auto

有啊

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

没有状态常量吧 只是可以设置箭头位置

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

微信图片_20210126175359
singleLine 测试

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

image

@BlackC0
Copy link
Author

BlackC0 commented Jan 26, 2021

这个是朝向哦

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

哦哦,箭头具体的位置这个功能没有。你可以考虑setOffsetX和setOffsetY调整

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

你先临时给textView设置一个合适的宽度吧!框架里面是通过View.measure(0, 0);后去获取的布局宽高,占时还不清楚是什么问题

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

你也可以看看BubbleDialog里面对传入的布局的处理,和宽高的获取是否因该怎么处理才恰当

@xujiaji
Copy link
Owner

xujiaji commented Jan 26, 2021

想起来了,因该是padding的问题,设置setBubbleLayout,创建一个BubbleLayout,然后设置它的padding为0,你试试

@BlackC0
Copy link
Author

BlackC0 commented Jan 27, 2021

setBubblePadding 0是可以 但也太丑了

@xujiaji
Copy link
Owner

xujiaji commented Jan 27, 2021

看看呢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants