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

X2C翻译各控件属性为.java的勘误 #55

Open
spianmo opened this issue Oct 25, 2019 · 0 comments
Open

X2C翻译各控件属性为.java的勘误 #55

spianmo opened this issue Oct 25, 2019 · 0 comments

Comments

@spianmo
Copy link
Contributor

spianmo commented Oct 25, 2019

关于除第三方控件之外的常用组件进行属性翻译为java的必要勘误。

 /**
         * X2C在TextView中的BUG
         * TextView的setTypeface方法在仅斜体且字体不设置的情况下,形参不对,必须得至少传入一个Typeface
         * fix: .setTypeface(Typeface.DEFAULT,Typeface.ITALIC);
         */
        TextView textView = new TextView(getContext());
        textView.setTypeface(Typeface.ITALIC);
        

        /**
         * X2C在CoordinatorLayout中的BUG
         * CoordinatorLayout不能当LinearLayout处理,CoordinatorLayout没有.setOrientation()方法
         * fix:可不做处理
         */
        CoordinatorLayout coordinatorLayout = new CoordinatorLayout(getContext());
        coordinatorLayout.setOrientation(LinearLayout.VERTICAL);


        /**
         * X2C在CoordinatorLayout.LayoutParams中的BUG
         * CoordinatorLayout.LayoutParams没有addRule()方法
         */

        CoordinatorLayout.LayoutParams layoutParam = new CoordinatorLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT);
        layoutParam.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM,RelativeLayout.TRUE);

        /**
         * FloatingActionMenu.LayoutParams第三方控件的LayoutParams设置方式各不相同
         */
        
        FloatingActionMenu.LayoutParams layoutParam1 =  new FloatingActionMenu.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,ViewGroup.LayoutParams.WRAP_CONTENT);
        layoutParam1.gravity= Gravity.BOTTOM|Gravity.END ;


        /**
         * X2C在ProgressBar中的BUG
         * ProgressBar没有setMaxWidth()和setMaxHeight()方法
         */
        
        ProgressBar progressBar = new ProgressBar(getContext());
        progressBar.setMaxWidth((int)(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,32,res.getDisplayMetrics())));
        progressBar.setMaxHeight((int)(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,32,res.getDisplayMetrics())));
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

1 participant