android+o+界面,Android O 主界面和所有应用界面行和列的修改

Android 8.1中\alps\packages\apps\Launcher3\src\com\android\launcher3\InvariantDeviceProfile.java

控制着行和列的实现。

public InvariantDeviceProfile(InvariantDeviceProfile p) {

this(p.name, p.minWidthDps, p.minHeightDps, p.numRows, p.numColumns,

p.numFolderRows, p.numFolderColumns, p.minAllAppsPredictionColumns,

p.iconSize, p.landscapeIconSize, p.iconTextSize, p.numHotseatIcons,

p.defaultLayoutId, p.demoModeLayoutId);

}

InvariantDeviceProfile(String n, float w, float h, int r, int c, int fr, int fc, int maapc,

float is, float lis, float its, int hs, int dlId, int dmlId) {

name = n;

minWidthDps = w;

minHeightDps = h;

numRows = r;

numColumns = c;

numFolderRows = fr;

numFolderColumns = fc;

minAllAppsPredictionColumns = maapc;

iconSize = is;

landscapeIconSize = lis;

iconTextSize = its;

numHotseatIcons = hs;

defaultLayoutId = dlId;

demoModeLayoutId = dmlId;

}

p.name, p.minWidthDps, p.minHeightDps, p.numRows, p.numColumns,p.numFolderRows, p.numFolderColumns, p.minAllAppsPredictionColumns, p.iconSize, p.landscapeIconSize, p.iconTextSize, p.numHotseatIcons,p.defaultLayoutId, p.demoModeLayoutId这些分别是界面的一些信息。

p.numRows, p.numColumns,p.numHotseatIcons控制着主界面和所有应用界面的行和列。

ArrayList getPredefinedDeviceProfiles(Context context) {

ArrayList profiles = new ArrayList<>();

try (XmlResourceParser parser = context.getResources().getXml(R.xml.device_profiles)) {

final int depth = parser.getDepth();

int type;

while (((type = parser.next()) != XmlPullParser.END_TAG ||

parser.getDepth() > depth) && type != XmlPullParser.END_DOCUMENT) {

if ((type == XmlPullParser.START_TAG) && "profile".equals(parser.getName())) {

TypedArray a = context.obtainStyledAttributes(

Xml.asAttributeSet(parser), R.styleable.InvariantDeviceProfile);

int numRows = a.getInt(R.styleable.InvariantDeviceProfile_numRows, 0);

int numColumns = a.getInt(R.styleable.InvariantDeviceProfile_numColumns, 0);

float iconSize = a.getFloat(R.styleable.InvariantDeviceProfile_iconSize, 0);

profiles.add(new InvariantDeviceProfile(

a.getString(R.styleable.InvariantDeviceProfile_name),

a.getFloat(R.styleable.InvariantDeviceProfile_minWidthDps, 0),

a.getFloat(R.styleable.InvariantDeviceProfile_minHeightDps, 0),

5,//wy

6,//wy

a.getInt(R.styleable.InvariantDeviceProfile_numFolderRows, numRows),

a.getInt(R.styleable.InvariantDeviceProfile_numFolderColumns, numColumns),

a.getInt(R.styleable.InvariantDeviceProfile_minAllAppsPredictionColumns, numColumns),

iconSize,

a.getFloat(R.styleable.InvariantDeviceProfile_landscapeIconSize, iconSize),

a.getFloat(R.styleable.InvariantDeviceProfile_iconTextSize, 0),

6,//wy

a.getResourceId(R.styleable.InvariantDeviceProfile_defaultLayoutId, 0),

a.getResourceId(R.styleable.InvariantDeviceProfile_demoModeLayoutId, 0)));

a.recycle();

}

}

} catch (IOException|XmlPullParserException e) {

throw new RuntimeException(e);

}

return profiles;

}

在new InvariantDeviceProfile()中修改想要的信息即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值