Setting button alignment programmatically

后端 未结 4 1257
轮回少年
轮回少年 2020-12-22 10:51

I\'m creating some 50 button dynamically.
Text is getting set as followed:

btn.Text=result.Rows[i]["Col1"].ToString()+"\\n"+result.Row         


        
4条回答
  •  有刺的猬
    2020-12-22 11:04

    In the original question, I wonder if the source text contained some extra space characters? That would explain img1 and img2.

    Anyway, my need to left-align the text in a button led me to this page, and here's the solution I ended up with, based on Alix Bloom's answer:

    Button myButton = new Button(getActivity());
    myButton(Gravity.LEFT);
    

提交回复
热议问题