導航:首頁 > 文字圖片 > button圖片和文字

button圖片和文字

發布時間:2022-10-14 23:24:42

⑴ iOS 調整UIButton 圖片(imageView)與文字(titleLabel)的位置

UIButton可以同時設置Title和Image,UIButton有兩個屬性:titleEdgeInsets(top,left,bottom,right)和imageEdgeInsets(top,left,bottom,right),通過設置這兩個,就可以實現所有需要的Button的樣式
UIButton 的 默認狀態下imageEdgeInsets = UIEdgeInsetsMake(0,0,0,0);titleEdgeInsets = UIEdgeInsetsMake(0,0,0,0); 圖片在左文字在右,而且整體水平和垂直居中 。比如下面這個圖文按鈕:

為了最美觀一點,可以設置圖標與文字間距 。如下圖:

設置圖片在右文字在左:

設置圖片在上,文字在下:

設置圖片左對齊:

設置文字右對齊:

設置文字左對齊,圖片右對齊:

⑵ asp.net 怎麼做一個帶圖片和文字的button

<asp:ImageButtonID="btnSubmit"
runat="server"ImageUrl="http://www..com/img/_sylogo1.gif"/>效果
你可以定義寬高,和圖片url。或者直接用
<asp:ButtonID="btnLogin"runat="server"Text="登錄"
CssClass="btn_5"/>寫在樣式里邊

.btn_b1{width:155px;height:90px;line-height:60px;border:0px;font-size:14px;text-align:center;color:#fff;background:url(../images/btn_b1.png)no-repeat;cursor:pointer;display:inline-block;text-decoration:none;font-weight:bold;}
.btn_b1:hover{color:#fff;text-decoration:none;}

⑶ 自定義BUTTON裡面放一個圖片和一個字元串

用TextView吧,能實現所有button的功能。而且設置文字和圖片共存也簡單,和setCompoundDrawables都可以實現。

⑷ asp.net 怎麼做一個帶圖片和文字的button

<asp:ImageButtonID="btnSubmit" runat="server"ImageUrl="http://www..com/img/_sylogo1.gif"/>效果

你可以定義寬高,和圖片url。或者直接用

<asp:ButtonID="btnLogin"runat="server"Text="登錄" CssClass="btn_5"/>寫在樣式里邊

.btn_b1{width:155px;height:90px;line-height:60px;border:0px;font-size:14px;text-align:center;color:#fff;background:url(../images/btn_b1.png)no-repeat;cursor:pointer;display:inline-block;text-decoration:none;font-weight:bold;}

.btn_b1:hover{color:#fff;text-decoration:none;}

如何在css中設置按鈕button中包含圖片文字對齊方式

align="middle" ,你可以通過這個屬性來調試一下,看看是劇中還居左或右適合你

⑹ 詳解button設置文字和圖片

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

button.backgroundColor = kRandomColor;

button.tag = i + addTag;

button.frame = CGRectMake(kScreenWidth / 3 * i, 0, kScreenWidth / 3, 50);

//首先設置需要顯示的文字和圖片

[button setTitle:titleArray[i] forState:UIControlStateNormal];

[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];

[button setImage:image forState:UIControlStateNormal];

//再將文字和圖片進行偏移處理

//這里+3和-3是需要文字和圖片有一定的間隔

[button setTitleEdgeInsets:UIEdgeInsetsMake(0, -image.size.width, 0, image.size.width)];

[button setImageEdgeInsets:UIEdgeInsetsMake(0, button.titleLabel.bounds.size.width+3, 0, -button.titleLabel.bounds.size.width-3)];

//自己去將圖片進行修改

- (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size{

// 創建一個bitmap的context

// 並把它設置成為當前正在使用的context

UIGraphicsBeginImageContext(size);

// 繪制改變大小的圖片

[img drawInRect:CGRectMake(0, 0, size.width, size.height)];

// 從當前context中創建一個改變大小後的圖片

UIImage* scaledImage = ();

// 使當前的context出堆棧

UIGraphicsEndImageContext();

// 返回新的改變大小後的圖片

return scaledImage;

}

閱讀全文

與button圖片和文字相關的資料

熱點內容
猛男生蛋糕圖片大全 瀏覽:913
男生鳥仔圖片 瀏覽:90
大清銅幣二十文真品價格及圖片 瀏覽:936
小紅旗價格及圖片 瀏覽:975
藍天白雲圖片大全高清 瀏覽:980
黑色的小人女孩到媽媽圖片 瀏覽:45
古裝男生圖片大全可愛 瀏覽:407
手腕紋身英文字母圖片 瀏覽:56
如何可以搜索圖片中的文字 瀏覽:523
簡單的名片模板圖片 瀏覽:654
初中女孩包包圖片大全 瀏覽:169
家用桑拿房圖片價格 瀏覽:948
頭發擋臉的圖片高清 瀏覽:492
在自然中奔跑歡笑的動漫女孩圖片 瀏覽:813
小孩可愛滑梯圖片 瀏覽:103
美女短發辮子圖片 瀏覽:458
圖片劇照文字 瀏覽:46
文字圖片有些人 瀏覽:10
10歲女生畫動漫人物圖片 瀏覽:4
胸小如何搭配衣服圖片 瀏覽:995