本文整理匯總了Java中android.widget.ImageView.setImageLevel方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageView.setImageLevel方法的具體用法?Java ImageView.setImageLevel怎麽用?Java ImageView.setImageLevel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.ImageView
的用法示例。
在下文中一共展示了ImageView.setImageLevel方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getView
import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
View view = convertView;
if (view == null) {
final LayoutInflater inflater = LayoutInflater.from(parent.getContext());
view = inflater.inflate(R.layout.feature_uart_button, parent, false);
}
view.setEnabled(isEnabled(position));
view.setActivated(mEditMode);
// Update image
final Command command = (Command) getItem(position);
final ImageView image = (ImageView) view;
final boolean active = command != null && command.isActive();
if (active) {
final int icon = command.getIconIndex();
image.setImageResource(R.drawable.uart_button);
image.setImageLevel(icon);
} else
image.setImageDrawable(null);
return view;
}
示例2: onBindView
import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public void onBindView(View view) {
TextView label = (TextView) view.findViewById(R.id.suw_items_title);
label.setText(getTitle());
TextView summaryView = (TextView) view.findViewById(R.id.suw_items_summary);
CharSequence summary = getSummary();
if (summary != null && summary.length() > 0) {
summaryView.setText(summary);
summaryView.setVisibility(View.VISIBLE);
} else {
summaryView.setVisibility(View.GONE);
}
final View iconContainer = view.findViewById(R.id.suw_items_icon_container);
final Drawable icon = getIcon();
if (icon != null) {
final ImageView iconView = (ImageView) view.findViewById(R.id.suw_items_icon);
// Set the image drawable to null before setting the state and level to avoid affecting
// any recycled drawable in the ImageView
iconView.setImageDrawable(null);
iconView.setImageState(icon.getState(), false /* merge */);
iconView.setImageLevel(icon.getLevel());
iconView.setImageDrawable(icon);
iconContainer.setVisibility(View.VISIBLE);
} else {
iconContainer.setVisibility(View.GONE);
}
view.setId(getViewId());
}
示例3: getView
import android.widget.ImageView; //導入方法依賴的package包/類
@Override
public View getView(final int position, final View convertView, final ViewGroup parent) {
View view = convertView;
if (view == null) {
view = LayoutInflater.from(getActivity()).inflate(R.layout.feature_uart_dialog_edit_icon, parent, false);
}
final ImageView image = (ImageView) view;
image.setImageLevel(position);
image.setActivated(position == mActiveIcon && mActiveCheckBox.isChecked());
return view;
}
示例4: scrollToTab
import android.widget.ImageView; //導入方法依賴的package包/類
private void scrollToTab(int tabIndex, float positionOffset) {
final int tabStripChildCount = tabStrip.getChildCount();
if (tabStripChildCount == 0 || tabIndex < 0 || tabIndex >= tabStripChildCount) {
return;
}
LinearLayout selectedTab = (LinearLayout) getTabAt(tabIndex);
if (0f <= positionOffset && positionOffset < 1f) {
if(!tabLayoutState){
ImageView imageView = (ImageView) selectedTab.getChildAt(0);
((RevealDrawable)imageView.getDrawable()).setOrientation(RevealDrawable.VERTICAL);
imageView.setImageLevel((int) (positionOffset * 5000 + 5000));
}
if(flag){
ChangeTextView textView = (ChangeTextView) selectedTab.getChildAt(1);
textView.setLevel((int) (positionOffset * 5000 + 5000));
}
}
if(!(tabIndex + 1 >= tabStripChildCount)){
LinearLayout tab = (LinearLayout) getTabAt(tabIndex + 1);
if(!tabLayoutState){
ImageView img = (ImageView) tab.getChildAt(0);
((RevealDrawable)img.getDrawable()).setOrientation(RevealDrawable.VERTICAL);
img.setImageLevel((int) (positionOffset * 5000));
}
if(flag){
ChangeTextView text = (ChangeTextView) tab.getChildAt(1);
text.setLevel((int) (positionOffset * 5000));
}
}
int titleOffset = tabViewHeight * 2;
int extraOffset = (int) (positionOffset * selectedTab.getHeight());
int y = (tabIndex > 0 || positionOffset > 0) ? -titleOffset : 0;
int start = selectedTab.getTop();
y += start + extraOffset;
scrollTo(0, y);
}
示例5: setPageScrolled
import android.widget.ImageView; //導入方法依賴的package包/類
/**
* 水平VIewPager控製
*/
public void setPageScrolled(int p, int position, float positionOffset) {
if (page != p){
return;
}
//豎屏狀態下`ViewPage`的`onPageScrolled`監聽不正常修複(統一數據)
if (positionOffset > 0.99 && positionOffset < 1){
positionOffset = 0;
position = position + 1;
}else if (positionOffset < 0.01 && positionOffset > 0.00001){
positionOffset = 0;
}
if (position - lastPosition[page] > 0) {
if (lastPosition[page] != ARRAY_INITIAL_VALUE){
tabLayoutState = false; //每次向左滑動結束時,進入判斷,菜單關閉狀態
tabLayoutIsClick = true;
}
}else if(position - lastPosition[page] < 0){
if(lastValue[page] - positionOffset < 0){
//向左滑動時,不操作。
return;
}
}
lastPosition[page] = position;
lastValue[page] = positionOffset;
if(positionOffset == 0){
return;
}
if(tabLayoutState){ //防止重複收起
final int tabStripChildCount = tabStrip.getChildCount();
if (tabStripChildCount == 0 || page < 0 || page >= tabStripChildCount) {
return;
}
LinearLayout selectedTab = (LinearLayout) getTabAt(page);
ImageView imageView = (ImageView) selectedTab.getChildAt(0);
((RevealDrawable)imageView.getDrawable()).setOrientation(RevealDrawable.HORIZONTAL);
if (0f < positionOffset && positionOffset <= 1f) {
imageView.setImageLevel((int) ((1 - positionOffset) * 5000 + 5000));
}
for (int i = 0, size = tabStrip.getChildCount(); i < size; i++) {
ChangeTextView textView = (ChangeTextView) ((LinearLayout) tabStrip.getChildAt(i)).getChildAt(1);
if (0f < positionOffset && positionOffset <= 1f) {
textView.setAlpha((1 - positionOffset));
if(positionOffset > 0.9f){
textView.setVisibility(INVISIBLE);
tabLayoutIsClick = false; //防止同時點擊,導致狀態混亂
}else{
textView.setVisibility(VISIBLE);
tabLayoutIsClick = true;
}
}
}
if (positionOffset > 0.98){
positionOffset = 1;
}
tabStrip.onViewPagerPageChanged(positionOffset);
}
}