android設置屬性
Ⅰ android studio怎麼設置插件屬性
android studio怎麼設置插件屬性
方法/步驟
點擊菜單欄的「File「->「Settings」,打開Settings窗口。
點擊「IDE Settings」下面的「File and Code Templates」,然後選中Templates裡面的Class。
然後選中Includes tab下面的File Header。
在最右邊的輸入框中就可以輸入我們想要設置的注釋模板了。比如我們輸入:
/**
* 作者:${USER} on ${DATE} ${HOUR}:${MINUTE}
* 郵箱:[email protected]
*/
然後點擊ok。
然後在android studio中新建一個類Test,可以看到自動添加了注釋。
Ⅱ Android MPAndroidChart 折線圖設置哪些屬性
在org.achartengine.renderer這個包里有一個類BasicStroke,可以改變線型(實線、虛線、點線),而折線圖中用的是XYMultipleSeriesRenderer這個類,它繼承自DefaultRenderer,這個與BasicStroke是一個包里的子類,DefaultRenderer有一個方法是setShowGridY(boolean showGrid),感覺在這個方法里肯定有設置線型的語句,但是我現在沒找到AChartEngine的具體五毛源碼,不知道這個方法具體是怎樣的,只能提供給你一個思路……我幾個月前也搗鼓過AChartEngine
Ⅲ android 自定義控制項 屬性怎麼用
自定義屬性設置
public class lei extends RelativeLayout {
private TextView tv1
public lei(Context context) {
super(context);
}
public lei(Context context, AttributeSet attrs) {
super(context, attrs);
LayoutInflater.from(context).inflate(R.layout.item,this);
tv1 = findViewById(R.id.tv1);
TypedArray array = context.obtainStyledAttributes(attrs,R.styleable.lei);
String str1 = (String) array.getText(R.styleable.lei_settitle);
int str2 = array.getColor(R.styleable.lei_setbackgroudcolor,Color.BLACK);
tv1.setText(str1);
tv1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getContext(), "toast", Toast.LENGTH_SHORT).show();
}
});
array.recycle();
}
}
布局控制項
<com.example.administrator.myapplication.lei
android:id="@+id/ll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
cs:setbackgroudcolor="#158616"
cs:settitle="這個是標題"
cs:settitletextcolor="#FFFFFF"
cs:settextrcolor="#FFFFFF"
>
</com.example.administrator.myapplication.lei>
屬性設置
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="lei" >
<attr name="setbackgroudcolor" format="color|reference"/>
<attr name="settitle" format="string|reference"/>
<attr name="settextrcolor" format="color"/>
<attr name="settitletextcolor" format="color"/>
</declare-styleable>
</resources>
Ⅳ android screenOrientation屬性
在開發android的應用中,有時候需要限制橫豎屏切換。只需要在AndroidManifest.xml文件中加入android:screenOrientation屬性限制。
android:screenOrientation="landscape"是限制此頁面橫屏顯示,
android:screenOrientation="portrait"是限制此頁面數豎屏顯示。
[html] view plain
android:screenOrientation="landscape"是限制此頁面橫屏顯示,
android:screenOrientation="portrait"是限制此頁面數豎屏顯示。
android:screenOrientation設定該活動的方向,該值可以是任何一個下面的字元串:
"unspecified"
- 默認值. 由系統選擇顯示方向. 在不同的設備可能會有所不同.
"landscape"
- 橫向
"portrait"
- 縱向
"user"
- 用戶當前的首選方向
"behind"
- 與在活動堆棧下的活動相同方向
"sensor"
- 根據物理方向感測器確定方向. 取決於用戶手持的方向, 當用戶轉動設備, 它跟隨改變.
"nosensor"
- 不經物理方向感測器確定方向. 該感測器被忽略, 所以當用戶轉動設備, 顯示不會跟隨改變. 除了這個區別,系統選擇使用相同的政策取向對於「未指定」設置. 系統根據「未指定」("unspecified")設定選擇相同顯示方向.
如果要使Activity的View界面全屏,只需要將最上面的信號欄和Activity的Title欄隱藏掉即可,隱藏Title欄的代碼:
requestWindowFeature(Window.FEATURE_NO_TITLE);
配置文件里代碼:
android:theme="@android:style/Theme.NoTitleBar"
隱藏信號欄的代碼:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
其它使用:
getWindow().setFlags(WindowManager.LayoutParams.TYPE_STATUS_BAR, WindowManager.LayoutParams.TYPE_STATUS_BAR);
Ⅳ 如何設置Android 系統的屬性,Build.prop,defualt.prop
用re管理器進入/system進去後會看到build.prop長按出來的選項中選擇文本編輯器打開,如果打不開,看右上角的許可權是否是讀寫,不是的話改一下許可權就好了。編輯好後按菜單鍵會有保存選項,選擇保存,就好了。改動前請先備份。如果出問題了再替換回來。
Ⅵ Android如何多個控制項設置一個屬性
通過設置公共style的方式對同一個屬性進行統一設置
1、res/values文件夾下新建一個xml文件
<?xmlversion="1.0"encoding="utf-8"?>
<resources>
<!--定義一個叫et1的style-->
<stylename="et1"parent="@android:style/Widget.EditText">
<!--設置控制項的背景色-->
<itemname="android:background">#1A4EA4</item>
</style>
</resources>
2、組件中使用
<EditTextandroid:layout_width="fill_parent"android:id="@+id/et2"
android:text="自定義樣式一"android:layout_height="wrap_content"style="@style/et1"></EditText><!--設置style為et1,需要設置同樣屬性的其他組件可以都設置成同一個style-->
Ⅶ 如何使用Android系統屬性
1. 在system.prop裡面添加需要使用的系統屬性,添加完後需要編譯生成system.img
2. 在native層,使用property_set(...)和property_get(...)來存取系統屬性
3. 在java層, 使用SystemProperties.set(...)和SystemProperties.get(...)來存取系統屬性
4. 在adb shell命令行,使用getprop和setprop來存取系統屬性
Ⅷ 屬性android:inputType用於設置文本輸入類型,其屬性值可以設置為以下哪些值
android:inputType="none"//輸入普通字元
android:inputType="text"//輸入普通字元
android:inputType="textCapCharacters"//輸入普通字元
android:inputType="textCapWords"//單詞首字母大小
android:inputType="textCapSentences"//僅第一個字母大小
android:inputType="textAutoCorrect"//前兩個自動完成
android:inputType="textAutoComplete"//前兩個自動完成
android:inputType="textMultiLine"//多行輸入
android:inputType="textImeMultiLine"//輸入法多行(不一定支持)
android:inputType="textNoSuggestions"//不提示
android:inputType="textUri"//URI格式
android:inputType="textEmailAddress"//電子郵件地址格式
android:inputType="textEmailSubject"//郵件主題格式
android:inputType="textShortMessage"//短消息格式
android:inputType="textLongMessage"//長消息格式
android:inputType="textPersonName"//人名格式
android:inputType="textPostalAddress"//郵政格式
android:inputType="textPassword"//密碼格式
android:inputType="textVisiblePassword"//密碼可見格式
android:inputType="textWebEditText"//作為網頁表單的文本格式
android:inputType="textFilter"//文本篩選格式
android:inputType="textPhonetic"//拼音輸入格式
//數值類型
android:inputType="number"//數字格式
android:inputType="numberSigned"//有符號數字格式
android:inputType="numberDecimal"//可以帶小數點的浮點格式
android:inputType="phone"//撥號鍵盤
android:inputType="datetime"//日期+時間格式
android:inputType="date"//日期鍵盤
android:inputType="time"//時間鍵盤
Ⅸ android的Activity控制項標題欄的屬性怎麼設置啊
Activity的標題欄,叫ActionBar,ActionBar位於Activity的頂部,可用來顯示activity的標題、Icon、Actions和一些用於交互的View。它也可被用於應用的導航。
ActionBar
標題欄常用屬性:
showAsAction屬性用來定義每個Action是如何顯示的
always表示永遠顯示在ActionBar中,如果屏幕空間不夠則無法顯示
ifRoom表示屏幕空間夠的情況下顯示在ActionBar中,不夠的話就顯示在overflow中
never則表示永遠顯示在overflow中
Ⅹ 如何提升APP許可權去修改android系統屬性
Systemproperties類在android.os下,但這個類是隱藏的, 上層程序開發無法直接使用。其實用java的反射機制是可以使用這個類。何謂java反射機制,請自行研究學習,在此不做介紹,放到後續文章中。用JNI 的方式,可以繞過Systemproperties這個類,直接本地調用來實現創建、獲取及修改系統屬性。在此也不做介紹,也放到後續文章中。
創建與修改android屬性用Systemproperties.set(name, value),獲取android屬性用Systemproperties.get(name),需要注意的是android屬性的名稱是有一定的格式要求的,如下: 前綴必須用system\core\init\property_service.c中定義的前綴 ,進行系統屬性設置的程序也必須有system或root許可權,
如何將android程序的許可權提升到system許可權?方法是這樣的:
1、在AndroidManifest.xml中,在manifest添加android:sharedUserId="android.uid.system "。
2、在Android.mk中,將LOCAL_CERTIFICATE := XXX修改成LOCAL_CERTIFICATE := platform 。
經過以上兩步就可以把ap的許可權提升到system許可權了。 但是用這種方法提升許可權有兩個弊端,如下:
1、程序的擁有都必須有程序的源碼;
2、程序的擁有都還必須有android開發環境,就是說自己能make整個android系統。
一般能做這兩點的,基本上都是開發人員!