欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

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

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

本文鏈接:

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

```

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

shape xmlns:android=""

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

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

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? ?

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

item

android:right="1dp"

android:left="1dp"

android:top="1dp"

android:bottom="1dp"

shape? ?

!--這個是背景顏色--

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

!--這個是按鈕中的字體與按鈕內(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è)置按鈕的四個角為弧形 --

corners

android:radius="5dip" /?

!--也可單獨設(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 無傳入圓角度數(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 對圖像進(jìn)行渲染

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

? ? //MIRROR(和REPEAT類似,但是每次重復(fù)的時候,將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;

? ? // 邊長取長寬最小值

? ? 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 對圖像進(jìn)行渲染

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

? ? //MIRROR(和REPEAT類似,但是每次重復(fù)的時候,將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對象

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

//抗鋸齒

roundImg.setAntiAlias(true);

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

roundImg.setCornerRadius(30);

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

imageView.setImageDrawable(roundImg);

```

```

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

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

Bitmap bitmap = null;

//將長方形圖片裁剪成正方形圖片

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);

//圓角半徑為正方形邊長的一半

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

//抗鋸齒

roundedBitmapDrawable.setAntiAlias(true);

imageView.setImageDrawable(roundedBitmapDrawable);

```

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

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

復(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中有一個父類屬性parent, 這個屬性是說明當(dāng)前的這個style是繼承自那個style的,當(dāng)然這個style的屬性值中都包含那個屬性中的,你也可以修改繼承到的屬性的值,好了,style完成了,我們可以測試一下效果了,先寫一個布局文件,比如說一個TextView什么的,可以用到這個style的。這里我就寫一個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="測試一下下"/

/LinearLayout

說完了style,下面就說說Theme,Theme跟style差不多,但是Theme是應(yīng)用在Application或者Activity里面的,而Style是應(yīng)用在某一個View里面的,還是有區(qū)別的,好了,廢話不多說,還是看代碼吧。下面的是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中有一個父類屬性parent, 這個屬性是說明當(dāng)前的這個style是繼承自那個style的,當(dāng)然這個style的屬性值中都包含那個屬性中的,你也可以修改繼承到的屬性的值,好了,style完成了,我們可以測試一下效果了,先寫一個布局文件,比如說一個TextView什么的,可以用到這個style的。這里我就寫一個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="測試一下下"/

/LinearLayout

說完了style,下面就說說Theme,Theme跟style差不多,但是Theme是應(yīng)用在Application或者Activity里面的,而Style是應(yīng)用在某一個View里面的,還是有區(qū)別的,好了,廢話不多說,還是看代碼吧。下面的是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

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

然后我們在Manifest.xml里面的Application里面加一個Theme的屬性,這個屬性對應(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都是我們設(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);

}

}

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

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

華為手機改字體圖文方法:

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

2、點進(jìn)去,找到顯示這個選項。

3、就會看到“字體大小”跟“字體樣式”兩個選項。這也就是修改華為手機字體的地方了。

4、想要修改華為手機“字體大小”則比較簡單,點擊該選項即可??梢赃x擇你想要的字體大小。

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

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

7、選擇一個你喜歡的字體點擊下載。

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

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

END

注意事項

該方法只適用于華為手機。

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

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

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

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

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

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

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

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

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

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

廣告

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

網(wǎng)站托管運營