当前位置: 首页>>代码示例>>Java>>正文


Java Button.setAlpha方法代码示例

本文整理汇总了Java中android.widget.Button.setAlpha方法的典型用法代码示例。如果您正苦于以下问题:Java Button.setAlpha方法的具体用法?Java Button.setAlpha怎么用?Java Button.setAlpha使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.Button的用法示例。


在下文中一共展示了Button.setAlpha方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: changeTypeButton

import android.widget.Button; //导入方法依赖的package包/类
private void changeTypeButton(Button button, int type) {
    ImageView coins = (ImageView) mViewDetails.findViewById(R.id
            .reward_coins_icon);
    switch (type) {
        case ENABLE_BUTTON:
            coins.setAlpha(1);
            button.setAlpha(1);
            button.setEnabled(true);
            break;
        case DISABLE_BUTTON:
            coins.setAlpha(ALPHA);
            button.setAlpha(ALPHA);
            button.setEnabled(false);
            break;
        default:
            break;
    }
}
 
开发者ID:ArnauBlanch,项目名称:civify-app,代码行数:19,代码来源:AwardDetailsFragment.java

示例2: getView

import android.widget.Button; //导入方法依赖的package包/类
@Override
public View getView(final int position, View convertView, final ViewGroup parent)
{
    // inflate the layout for each list row
    convertView = LayoutInflater.from(getApplicationContext()).inflate(R.layout.cafe_food_item, parent, false);

    // get current item to be displayed
    final FoodItem currentItem = (FoodItem) getItem(position);

    // get the TextView for item name and item description
    TextView itemText = (TextView) convertView.findViewById(R.id.list_item_text);
    itemText.setText(currentItem.getName());

    TextView priceText = (TextView) convertView.findViewById(R.id.foodPrice);
    priceText.setText("Price: " + currentItem.getPrice());

    Button useButton = (Button) convertView.findViewById(R.id.list_item_btn);
    useButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            ((Cafe)game.getGameEnvironment().getOutdoorEnvironment(OptionType.CAFE_OPTION)).setSelectedFood((FoodItem)getItem(position));
            finish();
        }
    });

    // deactivate button if the player has not enough money
    if (game.getPlayer().getStats().getStatByIndex(StatType.MONEY) < currentItem.getPrice())
    {
        useButton.setEnabled(false);
        useButton.setAlpha(0.3f);
        itemText.setText(currentItem.getName() + " (Not enough money!)");
    }

    // returns the view for the current row
    return convertView;
}
 
开发者ID:serhataras,项目名称:Roomie,代码行数:37,代码来源:CafeActivity.java

示例3: setButton

import android.widget.Button; //导入方法依赖的package包/类
private void setButton(boolean enable) {
    final SwitchButton vpnButton = (SwitchButton) findViewById(R.id.button_start_vpn);
    final Button selectHosts = (Button) findViewById(R.id.button_select_hosts);
    if (enable) {
        vpnButton.setChecked(false);
        selectHosts.setAlpha(1.0f);
        selectHosts.setClickable(true);
    } else {
        vpnButton.setChecked(true);
        selectHosts.setAlpha(.5f);
        selectHosts.setClickable(false);
    }
}
 
开发者ID:x-falcon,项目名称:Virtual-Hosts,代码行数:14,代码来源:MainActivity.java

示例4: blinkDelayed

import android.widget.Button; //导入方法依赖的package包/类
public void blinkDelayed(Message msg) {
    Button b = (Button) findViewById(msg.arg1);
    b.setAlpha(0.4f);
    new AudioPlayer().play(getApplicationContext(), SimonColorImpl.fromInt(msg.arg1).getSoundId());
    Message m = MessageBuilder.withArg1(msg.what, msg.arg1);
    presenter.handleBlinkDelayedMessage(m);
}
 
开发者ID:simoneapp,项目名称:S3-16-simone,代码行数:8,代码来源:GameActivityImpl.java

示例5: processButtonEvent

import android.widget.Button; //导入方法依赖的package包/类
/**
 * Toggle visibility of previous and next buttons based on currently viewed feature info
 * @param mainLayout  LinearLayout
 * @param featureContents List of FeatureContents
 * @param calloutLayouts List of LinearLayouts
 * @param layerTitle TextView representing title of layer where feature is located
 * @param txtPopupCount TextView representing count of features identified
 * @param btnNext Button for navigating to next feature
 * @param btnPrev Button for navigating to previous feature
 * @param btnName String representing flag for which button to process logic for
 */
private void processButtonEvent(final LinearLayout mainLayout, final List<FeatureContent> featureContents,
    final List<LinearLayout> calloutLayouts, final TextView layerTitle, final TextView txtPopupCount, final Button btnNext, final Button btnPrev, final String btnName ){

  int currentIndex = getCurrentLayoutId();
  final View currentView = mainLayout.findViewById(currentIndex);
  if (btnName.equalsIgnoreCase("next") && currentIndex < featureContents.size() - 1){
    incrementCurrentLayoutId();

  }else if (btnName.equalsIgnoreCase("prev") && currentIndex > 0){
    decrementCurrentLayoutId();
  }

  final View newView = calloutLayouts.get(getCurrentLayoutId());
  replaceView(mainLayout, currentView,newView);

  // Reset the layer name in the callout
  final FeatureContent activeContent = featureContents.get(getCurrentLayoutId());
  final String layerName = activeContent.getLayerName();

  // Clear any selections
  clearSelections();

  // Select the feature
  activeContent.getFeatureLayer().selectFeature(activeContent.getFeature());

  layerTitle.setText(layerName);

  // Reset popup index
  txtPopupCount.setText(getCurrentLayoutId() + 1 + " of " + featureContents.size() );

  currentIndex = getCurrentLayoutId();

  // Adjust visual cues for navigating features
  if (currentIndex < featureContents.size() - 1){
    btnNext.setAlpha(1.0f);
  }else{
    btnNext.setAlpha(0.3f);
  }
  if (currentIndex > 0){
    btnPrev.setAlpha(1.0f);
  }else{
    btnPrev.setAlpha(0.3f);
  }
}
 
开发者ID:Esri,项目名称:mapbook-android,代码行数:56,代码来源:MapFragment.java

示例6: resetButton

import android.widget.Button; //导入方法依赖的package包/类
public void resetButton(int buttonId) {
    Button b = (Button)findViewById(buttonId);
    b.setAlpha(1);
}
 
开发者ID:simoneapp,项目名称:S3-16-simone,代码行数:5,代码来源:GameActivityImpl.java


注:本文中的android.widget.Button.setAlpha方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。