开发者

imageButton draw in bottom of the layout

开发者 https://www.devze.com 2023-03-31 00:42 出处:网络
I have ImageButton which create inside the code, // Create Button ImageButton imageButton = new ImageButton(mContext);

I have ImageButton which create inside the code,

    // Create Button 
    ImageButton imageButton = new ImageButton(mContext);
    imageButton.setBackgroundRe开发者_StackOverflow社区source(R.drawable.button);

    imageButton.setOnClickListener(this);
    LayoutParams myParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);

    addContentView(imageButton, myParams);

How can i draw it in the bottom of the layout ?


Try:

LinearLayout.LayoutParams lp= (LinearLayout.LayoutParams)myButton.getLayoutParams(); 
lp.layout_gravity=Gravity.BOTTOM; 
myButton.setLayoutParams(lp); 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号