成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

android設(shè)置樣式,android怎么設(shè)置文本框樣式

android設(shè)置控件樣式(邊框顏色,圓角)和圖片樣式(圓角)

本文鏈接:

為嶺東等地區(qū)用戶提供了全套網(wǎng)頁(yè)設(shè)計(jì)制作服務(wù),及嶺東網(wǎng)站建設(shè)行業(yè)解決方案。主營(yíng)業(yè)務(wù)為網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站設(shè)計(jì)、嶺東網(wǎng)站設(shè)計(jì),以傳統(tǒng)方式定制建設(shè)網(wǎng)站,并提供域名空間備案等一條龍服務(wù),秉承以專業(yè)、用心的態(tài)度為用戶提供真誠(chéng)的服務(wù)。我們深信只要達(dá)到每一位用戶的要求,就會(huì)得到認(rèn)可,從而選擇與我們長(zhǎng)期合作。這樣,我們也可以走得更遠(yuǎn)!

```

?xml version="1.0" encoding="utf-8"?

shape xmlns:android=""

solid android:color="@color/colorAccent" /

!-- 這里是設(shè)置為四周 也可以單獨(dú)設(shè)置某個(gè)位置為圓角--

corners android:topLeftRadius="5dp"

? ? android:topRightRadius="5dp"

? ? android:bottomRightRadius="5dp"

? ? android:bottomLeftRadius="5dp"/

stroke android:width="1dp" android:color="#000000" /

/shape

```

```

?xml version="1.0" encoding="UTF-8"?

layer-list xmlns:android=""? ?

!-- 邊框顏色值 --

item? ?

? shape? ?

? ? ? ? solid android:color="#3bbaff" /? ?

? /shape? ?

/item? ?

!--這個(gè)是按鈕邊框設(shè)置為四周 并且寬度為1--

item

android:right="1dp"

android:left="1dp"

android:top="1dp"

android:bottom="1dp"

shape? ?

!--這個(gè)是背景顏色--

? ? ? solid android:color="#ffffff" /? ? ? ?

!--這個(gè)是按鈕中的字體與按鈕內(nèi)的四周邊距--

? ? ? padding android:bottom="10dp"? ?

? ? ? ? ? ? android:left="10dp"? ?

? ? ? ? ? ? android:right="10dp"? ?

? ? ? ? ? ? android:top="10dp" /? ?

/shape? ? ? ?

/item? ?

/layer-list

```

使用:

```android:background="@drawable/button_edge"```

```

?xml version="1.0" encoding="UTF-8"?

shape

xmlns:android=""

android:shape="rectangle"

!-- 填充的顏色 --

solid android:color="#FFFFFF" /

!-- android:radius 弧形的半徑 --

!-- 設(shè)置按鈕的四個(gè)角為弧形 --

corners

android:radius="5dip" /?

!--也可單獨(dú)設(shè)置--

!-- corners --

!-- android:topLeftRadius="10dp"--

!-- android:topRightRadius="10dp"--

!-- android:bottomRightRadius="10dp"--

!--? android:bottomLeftRadius="10dp"--

!--? /? --

? ? **設(shè)置文字padding**

!-- padding:Button里面的文字與Button邊界的間隔 --

padding

? ? android:left="10dp"

? ? android:top="10dp"

? ? android:right="10dp"

? ? android:bottom="10dp"

? ? /

/shape

```

```

?xml version="1.0" encoding="utf-8"?

shape xmlns:android=""

solid android:color="#FFFFFF" /

corners android:topLeftRadius="10dp"

? ? android:topRightRadius="10dp"

? ? android:bottomRightRadius="10dp"

? ? android:bottomLeftRadius="10dp"/

/shape

```

使用:

```

android:background="@drawable/image_circle"

```

```

Glide.with(MainActivity.this).load(croppedUri)

.transform(new GlideRectRound(MainActivity.this,6)).into(headIcon);

```

```

import android.content.Context;

import android.content.res.Resources;

import android.graphics.Bitmap;

import android.graphics.BitmapShader;

import android.graphics.Canvas;

import android.graphics.Paint;

import android.graphics.RectF;

import android.util.Log;

import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;

/**

* Created by SiHao on 2018/3/3.

* Glide 的 圓角 圖片 工具類

*/

public class GlideRectRound extends BitmapTransformation {

private static float radius = 0f;

// 構(gòu)造方法1 無(wú)傳入圓角度數(shù) 設(shè)置默認(rèn)值為5

public GlideRectRound(Context context) {

? ? this(context, 5);

}

// 構(gòu)造方法2 傳入圓角度數(shù)

public GlideRectRound(Context context, int dp) {

? ? super(context);

? ? // 設(shè)置圓角度數(shù)

? ? radius = Resources.getSystem().getDisplayMetrics().density * dp;

}

// 重寫該方法 返回修改后的Bitmap

@Override

protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {

? ? return rectRoundCrop(pool,toTransform);

}

@Override

public String getId() {

? ? Log.e("getID",getClass().getName() + Math.round(radius));

? ? return getClass().getName() + Math.round(radius);? // 四舍五入

}

private Bitmap rectRoundCrop(BitmapPool pool, Bitmap source){

? ? if (source == null) return null;

? ? Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888); // ARGB_4444——代表4x4位ARGB位圖,ARGB_8888——代表4x8位ARGB位圖

? ? if (result == null) {

? ? ? ? result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);

? ? }

? ? Canvas canvas = new Canvas(result);

? ? Paint paint = new Paint();

? ? // setShader 對(duì)圖像進(jìn)行渲染

? ? // 子類之一 BitmapShader設(shè)置Bitmap的變換? TileMode 有CLAMP (取bitmap邊緣的最后一個(gè)像素進(jìn)行擴(kuò)展),REPEAT(水平地重復(fù)整張bitmap)

? ? //MIRROR(和REPEAT類似,但是每次重復(fù)的時(shí)候,將bitmap進(jìn)行翻轉(zhuǎn))

? ? paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));

? ? paint.setAntiAlias(true);? // 抗鋸齒

? ? RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());

? ? canvas.drawRoundRect(rectF, radius, radius, paint);

? ? return result;

}

}

```

圓角:

```

import android.content.Context;

import android.graphics.Bitmap;

import android.graphics.BitmapShader;

import android.graphics.Canvas;

import android.graphics.Paint;

import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;

import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;

/**

* Created by SiHao on 2018/3/3.

* Glide圓形圖片工具類

*/

public class GlideCircleBitmap extends BitmapTransformation{

public GlideCircleBitmap(Context context) {

? ? super(context);

}

// 重寫該方法 返回修改后的Bitmap

@Override

protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {

? ? return circleCrop(pool, toTransform);

}

@Override

public String getId() {

? ? return getClass().getName();

}

private static Bitmap circleCrop(BitmapPool pool, Bitmap source) {

? ? if (source == null) return null;

? ? // 邊長(zhǎng)取長(zhǎng)寬最小值

? ? int size = Math.min(source.getWidth(), source.getHeight());

? ? int x = (source.getWidth() - size) / 2;

? ? int y = (source.getHeight() - size) / 2;

? ? // TODO this could be acquired from the pool too

? ? Bitmap squared = Bitmap.createBitmap(source, x, y, size, size);

? ? Bitmap result = pool.get(size, size, Bitmap.Config.ARGB_8888);// ARGB_4444——代表4x4位ARGB位圖,ARGB_8888——代表4x8位ARGB位圖

? ? if (result == null) {

? ? ? ? result = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);

? ? }

? ? Canvas canvas = new Canvas(result);

? ? Paint paint = new Paint();

? ? // setShader 對(duì)圖像進(jìn)行渲染

? ? // 子類之一 BitmapShader設(shè)置Bitmap的變換? TileMode 有CLAMP (取bitmap邊緣的最后一個(gè)像素進(jìn)行擴(kuò)展),REPEAT(水平地重復(fù)整張bitmap)

? ? //MIRROR(和REPEAT類似,但是每次重復(fù)的時(shí)候,將bitmap進(jìn)行翻轉(zhuǎn))

? ? paint.setShader(new BitmapShader(squared, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));

? ? paint.setAntiAlias(true);// 抗鋸齒

? ? // 半徑取 size的一半

? ? float r = size / 2f;

? ? canvas.drawCircle(r, r, r, paint);

? ? return result;

}

}

```

```

URL url = new URL(String類型的字符串); //將String類型的字符串轉(zhuǎn)換為URL格式

holder.UserImage.setImageBitmap(BitmapFactory.decodeStream(url.openStream()));

```

```

//得到資源文件的BitMap

Bitmap image= BitmapFactory.decodeResource(getResources(),R.drawable.dog);

//創(chuàng)建RoundedBitmapDrawable對(duì)象

RoundedBitmapDrawable roundImg =RoundedBitmapDrawableFactory.create(getResources(),image);

//抗鋸齒

roundImg.setAntiAlias(true);

//設(shè)置圓角半徑

roundImg.setCornerRadius(30);

//設(shè)置顯示圖片

imageView.setImageDrawable(roundImg);

```

```

//如果是圓的時(shí)候,我們應(yīng)該把bitmap圖片進(jìn)行剪切成正方形, 然后再設(shè)置圓角半徑為正方形邊長(zhǎng)的一半即可

Bitmap image = BitmapFactory.decodeResource(getResources(), R.drawable.dog);

Bitmap bitmap = null;

//將長(zhǎng)方形圖片裁剪成正方形圖片

if (image.getWidth() == image.getHeight()) {

? bitmap = Bitmap.createBitmap(image, image.getWidth() / 2 - image.getHeight() / 2, 0, image.getHeight(), image.getHeight());

} else {

? bitmap = Bitmap.createBitmap(image, 0, image.getHeight() / 2 - image.getWidth() / 2, image.getWidth(), image.getWidth());

}

RoundedBitmapDrawable roundedBitmapDrawable = RoundedBitmapDrawableFactory.create(getResources(), bitmap);

//圓角半徑為正方形邊長(zhǎng)的一半

roundedBitmapDrawable.setCornerRadius(bitmap.getWidth() / 2);

//抗鋸齒

roundedBitmapDrawable.setAntiAlias(true);

imageView.setImageDrawable(roundedBitmapDrawable);

```

如何修改Android App的樣式風(fēng)格

android中可以自定義主題和風(fēng)格。風(fēng)格,也就是style,我們可以將一些統(tǒng)一的屬性拿出來(lái),比方說(shuō),長(zhǎng),寬,字體大小,字體顏色等等??梢栽趓es/values目錄下新建一個(gè)styles.xml的文件,在這個(gè)文件里面有resource根節(jié)點(diǎn),在根節(jié)點(diǎn)里面添加item項(xiàng),item項(xiàng)的名字就是屬性的名字,item項(xiàng)的值就是屬性的值,如下所示:

復(fù)制代碼 代碼如下:

?xml version="1.0" encoding="utf-8"?

resources

style name="MyText" parent="@android:style/TextAppearance"

item name="android:textColor"#987456/item

item name="android:textSize"24sp/item

/style

/resources

style中有一個(gè)父類屬性parent, 這個(gè)屬性是說(shuō)明當(dāng)前的這個(gè)style是繼承自那個(gè)style的,當(dāng)然這個(gè)style的屬性值中都包含那個(gè)屬性中的,你也可以修改繼承到的屬性的值,好了,style完成了,我們可以測(cè)試一下效果了,先寫一個(gè)布局文件,比如說(shuō)一個(gè)TextView什么的,可以用到這個(gè)style的。這里我就寫一個(gè)EditText吧。下面是布局文件:

復(fù)制代碼 代碼如下:

?xml version="1.0" encoding="utf-8"?

LinearLayout

xmlns:android="http://schemas。android。com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

EditText

android:id="@+id/myEditText"

android:layout_width="match_parent"

android:layout_height="match_parent"

style="@style/MyText"

android:text="測(cè)試一下下"/

/LinearLayout

說(shuō)完了style,下面就說(shuō)說(shuō)Theme,Theme跟style差不多,但是Theme是應(yīng)用在Application或者Activity里面的,而Style是應(yīng)用在某一個(gè)View里面的,還是有區(qū)別的,好了,廢話不多說(shuō),還是看代碼吧。下面的是style文件:

復(fù)制代碼 代碼如下:

?xml version="1.0" encoding="utf-8"?

resources

style name="MyText" parent="@android:style/TextAppearance"

item name="android:textColor"#987456/item

item name="android:textSize"24sp/item

/style

style parent="@android:style/Theme" name="CustomTheme"

item name="android:windowNoTitle"true/item

item name="android:windowFrame"@drawable/icon/item

item name="android:windowBackground"?android:windowFrame/item

/style

/resources

style中有一個(gè)父類屬性parent, 這個(gè)屬性是說(shuō)明當(dāng)前的這個(gè)style是繼承自那個(gè)style的,當(dāng)然這個(gè)style的屬性值中都包含那個(gè)屬性中的,你也可以修改繼承到的屬性的值,好了,style完成了,我們可以測(cè)試一下效果了,先寫一個(gè)布局文件,比如說(shuō)一個(gè)TextView什么的,可以用到這個(gè)style的。這里我就寫一個(gè)EditText吧。下面是布局文件:

復(fù)制代碼 代碼如下:

?xml version="1.0" encoding="utf-8"?

LinearLayout

xmlns:android="http://schemas。android。com/apk/res/android"

android:layout_width="match_parent"

android:layout_height="match_parent"

EditText

android:id="@+id/myEditText"

android:layout_width="match_parent"

android:layout_height="match_parent"

style="@style/MyText"

android:text="測(cè)試一下下"/

/LinearLayout

說(shuō)完了style,下面就說(shuō)說(shuō)Theme,Theme跟style差不多,但是Theme是應(yīng)用在Application或者Activity里面的,而Style是應(yīng)用在某一個(gè)View里面的,還是有區(qū)別的,好了,廢話不多說(shuō),還是看代碼吧。下面的是style文件:

復(fù)制代碼 代碼如下:

?xml version="1.0" encoding="utf-8"?

resources

style name="MyText" parent="@android:style/TextAppearance"

item name="android:textColor"#987456/item

item name="android:textSize"24sp/item

/style

style parent="@android:style/Theme" name="CustomTheme"

item name="android:windowNoTitle"true/item

item name="android:windowFrame"@drawable/icon/item

item name="android:windowBackground"?android:windowFrame/item

/style

/resources

可以看到這里寫了一個(gè)繼承自系統(tǒng)默認(rèn)的Theme的主題,里面有3個(gè)屬性,這里強(qiáng)調(diào)一下第三個(gè)屬性的值的問(wèn)題,這里打個(gè)問(wèn)號(hào),然后加前面的一個(gè)item的名字表示引用的是那個(gè)名字的值,也就是那個(gè)名字對(duì)應(yīng)的圖片。

然后我們?cè)贛anifest.xml里面的Application里面加一個(gè)Theme的屬性,這個(gè)屬性對(duì)應(yīng)的就是我們上面寫的Theme。

復(fù)制代碼 代碼如下:

application android:icon="@drawable/icon" android:label="@string/app_name"

android:theme="@style/CustomTheme"

activity android:name=".TestStyle"

android:label="@string/app_name"

intent-filter

action android:name="android.intent.action.MAIN" /

category android:name="android.intent.category.LAUNCHER" /

/intent-filter

/activity

上面的代碼沒有標(biāo)題欄,背景和fram都是我們?cè)O(shè)置的圖片。當(dāng)然也可以在代碼中設(shè)置主題:

復(fù)制代碼 代碼如下:

package com.test.shang;

import android.app.Activity;

import android.os.Bundle;

public class TestStyle extends Activity {

@Override

protected void onCreate (Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setTheme(R.style.CustomTheme);

setContentView(R.layout.test_style);

}

}

安卓手機(jī)怎么設(shè)置字體樣式

手機(jī)字體怎么改?自去年華為榮耀3C剛出不久,就入手了。到現(xiàn)在也沒有出什么問(wèn)題,質(zhì)量挺好的。因?yàn)槿A為的系統(tǒng)都是自己的,所以在這里跟大家分享一下華為手機(jī)改字體的訣竅。一起來(lái)看看吧!

華為手機(jī)改字體圖文方法:

1、打開手機(jī),找到設(shè)置圖標(biāo)。

2、點(diǎn)進(jìn)去,找到顯示這個(gè)選項(xiàng)。

3、就會(huì)看到“字體大小”跟“字體樣式”兩個(gè)選項(xiàng)。這也就是修改華為手機(jī)字體的地方了。

4、想要修改華為手機(jī)“字體大小”則比較簡(jiǎn)單,點(diǎn)擊該選項(xiàng)即可。可以選擇你想要的字體大小。

5、想要修改華為手機(jī)“字體樣式”則點(diǎn)擊該選項(xiàng)。進(jìn)入頁(yè)面之后,選擇“在線”。

6、在“在線”的頁(yè)面里選擇“最新”,就看一看很多字體。

7、選擇一個(gè)你喜歡的字體點(diǎn)擊下載。

8、下載完畢之后,點(diǎn)擊應(yīng)用。而這時(shí)則需要重啟手機(jī)。

9、重啟完畢之后,該字體就已經(jīng)應(yīng)用在手機(jī)里了。

END

注意事項(xiàng)

該方法只適用于華為手機(jī)。

以上就是華為手機(jī)改字體圖文方法,希望對(duì)大家有所幫助,謝謝大家閱讀本篇文章!

怎樣設(shè)置安卓系統(tǒng)手機(jī)上的字體???

1、首先我們進(jìn)入設(shè)置,如圖所示。

2、進(jìn)入設(shè)置頁(yè)面后,可以看見如圖所示的搜索欄。

3、可以直接在設(shè)置頁(yè)面的搜索欄中輸入“字體樣式”(如下圖)

4、也可以下拉列表,點(diǎn)擊“顯示”選擇“字體樣式”(如下圖)

5、再跳轉(zhuǎn)到的頁(yè)面,找到手機(jī)里面你喜歡的字體樣式,如圖所示。

6、然后點(diǎn)擊“應(yīng)用”,這時(shí)即可完成手機(jī)字體的修改,如圖所示。

本文題目:android設(shè)置樣式,android怎么設(shè)置文本框樣式
分享地址:http://jinyejixie.com/article48/dsdgehp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)公司、外貿(mào)建站自適應(yīng)網(wǎng)站、電子商務(wù)標(biāo)簽優(yōu)化

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營(yíng)
迁西县| 苍溪县| 昌江| 宁河县| 湘潭市| 云南省| 宁陕县| 会同县| 建宁县| 蚌埠市| 安泽县| 日土县| 湖口县| 鲁甸县| 炎陵县| 中卫市| 青田县| 独山县| 肥西县| 吴川市| 沧源| 阿鲁科尔沁旗| 新乡市| 昆明市| 柞水县| 亚东县| 都江堰市| 永清县| 平和县| 缙云县| 佳木斯市| 浮山县| 塔城市| 惠水县| 印江| 德阳市| 宁津县| 霍山县| 长海县| 上林县| 郎溪县|