Android移动终端开发大作业(2)

来源:网络收集 时间:2025-04-29 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xuecool-com或QQ:370150219 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

scrollToChild(currentPosition, 0);

if (pageListener != null)

{

(currentPosition);

}

}

});

}

private void addTextTab(final int position, String title)

{

TextView tab = new TextView(getContext());

(title);

;

();

addTab(position, tab);

}

private void addIconTab(final int position, int resId)

{

ImageButton tab = new ImageButton(getContext());

(resId);

addTab(position, tab);

}

private void addTab(final int position, View tab)

{

(true);

(new OnClickListener() {

@Override

public void onClick(View v)

{

(position);

}

});

(tabPadding, 0, tabPadding, 0);

(tab, position, shouldExpand expandedTabLayoutParams : defaultTabLayoutParams);

}

private void updateTabStyles()

{

for (int i = 0; i < tabCount; i++)

{

View v = (i);

(tabBackgroundResId);

if (v instanceof TextView)

{

TextView tab = (TextView) v;

, tabTextSize);

(tabTypeface, tabTypefaceStyle);

oString().toUpperCase(locale));

}

}

}

}

}

private void scrollToChild(int position, int offset)

{

if (tabCount == 0) { return; }

int newScrollX = (position).getLeft() + offset;

if (position > 0 || offset > 0)

{

newScrollX -= scrollOffset;

}

if (newScrollX != lastScrollX)

{

lastScrollX = newScrollX;

scrollTo(newScrollX, 0);

}

}

@Override

protected void onDraw(Canvas canvas)

{

(canvas);

if (isInEditMode() || tabCount == 0) { return; }

final int height = getHeight();

etWidth()));

invalidate();

if (delegatePageListener != null)

{

(position, positionOffset, positionOffsetPixels);

}

}

@Override

public void onPageScrollStateChanged(int state)

{

if (state ==

{

scrollToChild(), 0);

}

if (delegatePageListener != null)

{

(state);

}

}

@Override

public void onPageSelected(int position)

{

if (delegatePageListener != null)

{

(position);

}

updateTabStyles();

}

}

public void setIndicatorColor(int indicatorColor)

{

= indicatorColor;

invalidate();

}

public void setIndicatorColorResource(int resId)

{

= getResources().getColor(resId);

invalidate();

}

public int getIndicatorColor()

{

return ;

}

public void setIndicatorHeight(int indicatorLineHeightPx) {

= indicatorLineHeightPx;

invalidate();

}

public int getIndicatorHeight()

{

return indicatorHeight;

}

public void setUnderlineColor(int underlineColor)

{

= underlineColor;

invalidate();

}

public void setUnderlineColorResource(int resId)

{

= getResources().getColor(resId);

invalidate();

}

public int getUnderlineColor()

{

return underlineColor;

}

public void setDividerColor(int piderColor)

{

= piderColor;

invalidate();

}

public void setDividerColorResource(int resId)

{

= getResources().getColor(resId);

invalidate();

}

public int getDividerColor()

{

return piderColor;

}

public void setUnderlineHeight(int underlineHeightPx) {

= underlineHeightPx;

invalidate();

}

public int getUnderlineHeight()

{

return underlineHeight;

}

public void setDividerPadding(int piderPaddingPx) {

= piderPaddingPx;

invalidate();

}

public int getDividerPadding()

{

return piderPadding;

}

public void setScrollOffset(int scrollOffsetPx)

{

= scrollOffsetPx;

invalidate();

}

public int getScrollOffset()

{

return scrollOffset;

}

public void setShouldExpand(boolean shouldExpand) {

= shouldExpand;

requestLayout();

}

public boolean getShouldExpand()

{

return shouldExpand;

}

public boolean isTextAllCaps()

{

return textAllCaps;

}

public void setAllCaps(boolean textAllCaps)

{

= textAllCaps;

}

public void setTextSize(int textSizePx)

{

= textSizePx;

updateTabStyles();

}

public int getTextSize()

{

return tabTextSize;

}

public void setTextColor(int textColor)

{

= textColor;

updateTabStyles();

}

public void setTextColor(int textNormalColor, int textSelectedColor) {

= textNormalColor;

= textSelectedColor;

updateTabStyles();

}

public void setTextColorResource(int resId)

{

= getResources().getColor(resId);

updateTabStyles();

}

public int getTextColor()

{

return tabTextColor;

}

public void setTypeface(Typeface typeface, int style)

{

= typeface;

= style;

updateTabStyles();

}

public void setTabBackground(int resId)

{

= resId;

}

public int getTabBackground()

{

return tabBackgroundResId;

}

public void setTabPaddingLeftRight(int paddingPx)

{

= paddingPx;

updateTabStyles();

}

public int getTabPaddingLeftRight()

{

return tabPadding;

}

@Override

public void onRestoreInstanceState(Parcelable state)

{

SavedState savedState = (SavedState) state;

());

currentPosition = ;

requestLayout();

}

@Override

public Parcelable onSaveInstanceState()

{

Parcelable superState = ();

SavedState savedState = new SavedState(superState);

= currentPosition;

return savedState;

}

static class SavedState extends BaseSavedState

{

int currentPosition;

public SavedState(Parcelable superState) {

super(superState);

}

private SavedState(Parcel in) {

super(in);

currentPosition = ();

}

@Override

public void writeToParcel(Parcel dest, int flags)

{

(dest, flags);

(currentPosition);

}

public static final CREATOR = new () {

@Override

public SavedState createFromParcel(Parcel in)

{

return new SavedState(in);

}

@Override

public SavedState[] newArray(int size)

{

return new SavedState[size];

}

};

}

}

代码3:

*

* Licensed under the Apache License, Version (the "License");

* you may not use this file except in compliance with the License.

* You may obtain a copy of the License at

*

* Unless required by applicable law or agreed to in writing, software

* distributed under the License is distributed on an "AS IS" BASIS,

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and

* limitations under the License.

*/

public class BitmapUtils implements TaskHandler {

private boolean pauseTask = false;

private boolean cancelAllTask = false;

private final Object pauseTaskLock = new Object();

private Context context;

private BitmapGlobalConfig globalConfig;

private BitmapDisplayConfig defaultDisplayConfig;

etDrawable(resId));

return this;

}

public BitmapUtils configDefaultLoadingImage(Bitmap bitmap) {

(new BitmapDrawable(), bitmap));

return this;

}

public BitmapUtils configDefaultLoadFailedImage(Drawable drawable) {

百度搜索“70edu”或“70教育网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,70教育网,提供经典知识文库Android移动终端开发大作业(2)在线全文阅读。

Android移动终端开发大作业(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.70edu.com/fanwen/1369279.html(转载请注明文章来源)
Copyright © 2020-2025 70教育网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:370150219 邮箱:370150219@qq.com
苏ICP备16052595号-17
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:7 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:xuecool-com QQ:370150219