Java 类android.widget.Space 实例源码

项目:Tangram-Android    文件:SingleImageView.java   
private void initUI(Context context, int size){
    setOrientation(VERTICAL);
    setGravity(Gravity.CENTER_HORIZONTAL);
    setBackgroundColor(Color.WHITE);

    icon = new ImageView(context);
    icon.setScaleType(ImageView.ScaleType.CENTER_CROP);

    LayoutParams iconLp = new LayoutParams(size, size);
    iconLp.topMargin = Style.dp2px(8);
    addView(icon, iconLp);

    titleTextView = new TextView(context);
    titleTextView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 12);
    LayoutParams titleLp = new LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
            ViewGroup.LayoutParams.WRAP_CONTENT);
    titleLp.topMargin = Style.dp2px(4.0);
    addView(titleTextView, titleLp);

    Space space = new Space(context);
    LayoutParams spaceLp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            Style.dp2px(8));
    addView(space, spaceLp);
}
项目:road-trip-master    文件:MainActivity.java   
private void finishLoadingPhotos()
{
    mIntroView.stopWaitAnimation();

    LinearLayout container = (LinearLayout) findViewById(R.id.container);
    LayoutInflater inflater = getLayoutInflater();

    Space spacer = new Space(this);
    spacer.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            findViewById(R.id.scroller).getHeight()));
    container.addView(spacer);

    for (State s : mStates)
    {
        addState(inflater, container, s);
    }
}
项目:Atlas-Android    文件:AtlasMessagesAdapter.java   
public CellViewHolder(View itemView, Picasso picasso, boolean shouldShowAvatarPresence) {
    super(itemView);
    mUserName = (TextView) itemView.findViewById(R.id.sender);
    mTimeGroup = itemView.findViewById(R.id.time_group);
    mTimeGroupDay = (TextView) itemView.findViewById(R.id.time_group_day);
    mTimeGroupTime = (TextView) itemView.findViewById(R.id.time_group_time);
    mClusterSpaceGap = (Space) itemView.findViewById(R.id.cluster_space);
    mCell = (ViewGroup) itemView.findViewById(R.id.cell);
    mReceipt = (TextView) itemView.findViewById(R.id.receipt);

    mAvatar = ((AtlasAvatar) itemView.findViewById(R.id.avatar));
    if (mAvatar != null)  {
        mAvatar.init(picasso);
        mAvatar.setShouldShowPresence(shouldShowAvatarPresence);
    }
}
项目:AutoGapLinearLayout    文件:AutoGapLinearLayout.java   
@Override
public void addView(View child, int index, ViewGroup.LayoutParams params) {
    if (LOG_PRIORITY <= Log.VERBOSE) Log.v(LOG_TAG, "addView(View, int, ViewGroup.LayoutParams)");

    if (index >= 0 && index % 2 == 0) {
        if (LOG_PRIORITY <= Log.WARN) {
            Log.w(LOG_TAG, "addView(View, int, ViewGroup.LayoutParams) does nothing since indicated a gap index");
        }

        return;
    } else {
        super.addView(child, index, params);

        Space gap = generateGap();
        gap.setTag(child);

        if (index != -1) index++;

        float weight = 1;
        if (checkLayoutParams(params)) weight = ((LayoutParams) params).gap;

        super.addView(gap, index, generateGapLayoutParams(weight));
    }
}
项目:HeadsUp    文件:HeadsUpBase.java   
/**
 * Adds empty space view to {@link #mHolder#containerView container} for a
 * short {@link #LAYOUT_ANIMATION_TIME}. This uses {@link #mHandler}!
 *
 * @param height height of space view in pixels.
 */
private void addSpaceToContainer(final int height) {
    final Space space = new Space(mHolder.context);
    final ViewGroup.LayoutParams lp = new LinearLayout.LayoutParams(0, height);
    mHolder.containerView.addView(space, lp);
    mHolder.containerOffset++;

    // Remove space view after a while.
    mHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            mHolder.containerView.removeView(space);
            mHolder.containerOffset--;
        }
    }, LAYOUT_ANIMATION_TIME);
}
项目:ticdesign    文件:AlertController.java   
public void setup(Window window,
                  @IdRes int textButtonId, @IdRes int textSpaceId,
                  @IdRes int iconButtonId) {
    textButton = (Button) window.findViewById(textButtonId);
    textSpace = (Space) window.findViewById(textSpaceId);
    iconButton = (FloatingActionButton) window.findViewById(iconButtonId);
}
项目:android-custom-views-sample    文件:SampleActivity.java   
private void addSample(CharSequence title, View sample) {
    SampleView sampleView = new SampleView(this);
    sampleView.bind(title, sample);
    mSampleContainer.addView(sampleView);

    Space space = new Space(this);
    mSampleContainer.addView(space);
    space.getLayoutParams().height = getResources().getDimensionPixelSize(R.dimen.sample_padding);
}
项目:road-trip    文件:MainActivity.java   
private void finishLoadingPhotos() {
    mIntroView.stopWaitAnimation();

    LinearLayout container = (LinearLayout) findViewById(R.id.container);
    LayoutInflater inflater = getLayoutInflater();

    Space spacer = new Space(this);
    spacer.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
            findViewById(R.id.scroller).getHeight()));
    container.addView(spacer);

    for (State s : mStates) {
        addState(inflater, container, s);
    }
}
项目:patchfield    文件:PatchView.java   
private void deleteModuleView(String module) {
  View moduleView = moduleViews.remove(module);
  if (moduleView != null) {
    int index;
    for (index = 0; !moduleView.equals(getChildAt(index)); ++index);
    removeView(moduleView);
    // Warning: Atrocious hack to place views in the desired place, Part II.
    while (index > 0 && getChildAt(--index) instanceof Space) {
      removeViewAt(index);
    }
  }
  invalidateAll();
}
项目:ChemistryEasy    文件:OrdinaryTable.java   
public void Ui_init(View v){
    big_view = new BigViewController(v.getContext());
    Space space = new Space(v.getContext());
    Space space2 = new Space(v.getContext());
    space2.setLayoutParams(new GridLayout.LayoutParams(GridLayout.spec(0,0), GridLayout.spec(12,5)));
    final GridLayout table = (GridLayout) v.findViewById(R.id.table_layout);
    GridLayout lantan = (GridLayout) v.findViewById(R.id.lantan);
    GridLayout.LayoutParams bigViewParams = new GridLayout.LayoutParams(GridLayout.spec(0,3), GridLayout.spec(2,10));
    bigViewParams.width = x_size*BV_X_SIZE;
    bigViewParams.height = y_size*BV_Y_SIZE;
    big_view.setLayoutParams(bigViewParams);

    for(int i = 0; i < this.container.getSize(); i++) {
        ChemElement buf = this.container.getElementByNumber(i + 1);
        buf.setSize(x_size - (ELEMENTS_MARGIN_LEFT + ELEMENTS_MARGIN_RIGHT), y_size - (ELEMENTS_MARGIN_TOP + ELEMENTS_MARGIN_BUTTOM));
        switch (buf.getElementNumber()){
            case 2:
                table.addView(space);
                table.addView(big_view);
                table.addView(space2);
                break;
        }
        if(buf.isLantanoid())
        {
            lantan.addView(buf);
        }
        else {
            table.addView(buf);
        }
        buf.setOnClickListener(this);
        buf.setOnLongClickListener(this);
        GridLayout.LayoutParams params = (GridLayout.LayoutParams) buf.getLayoutParams();
        params.setMargins(ELEMENTS_MARGIN_LEFT,ELEMENTS_MARGIN_TOP,ELEMENTS_MARGIN_RIGHT,ELEMENTS_MARGIN_BUTTOM);
        buf.setLayoutParams(params);
    }

    temp = (SeekBar) v.findViewById(R.id.temp);
    temp.setOnSeekBarChangeListener(new TempSeekBarListener(temp));
    temp.setProgress(NORMAL_TEMPERATURE_K);
    temp_tx = (TextView) v.findViewById(R.id.temp_tx);
}
项目:blunch_android    文件:CollaborativeDishLayout.java   
public CollaborativeDishLayout(Context context) {
    super(context);
    setOrientation(HORIZONTAL);
    setGravity(Gravity.CENTER);
    setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    Space space1 = new Space(context);
    LinearLayout.LayoutParams spaceLayout = new LinearLayout.LayoutParams(40, ViewGroup.LayoutParams.MATCH_PARENT);
    addView(space1, spaceLayout);

    dishName = new EditText(context);
    dishName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    dishName.setTextColor(getResources().getColor(R.color.black));
    dishName.setHintTextColor(getResources().getColor(R.color.gray));
    dishName.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
    dishName.setHint("Nombre");
    dishName.setWidth(10);
    LinearLayout.LayoutParams nomPlatLayout = new LinearLayout.LayoutParams(350, ViewGroup.LayoutParams.WRAP_CONTENT);

    addView(dishName, nomPlatLayout);

    Space space5 = new Space(context);
    LinearLayout.LayoutParams space5Layout = new LinearLayout.LayoutParams(15, ViewGroup.LayoutParams.MATCH_PARENT);
    addView(space5, space5Layout);

    close = new ImageButton(context);
    close.setBackgroundColor(getResources().getColor(R.color.white));
    close.setImageResource(R.drawable.cross);
    close.setScaleType(ImageView.ScaleType.FIT_XY);
    close.setScaleX(0.5f);
    close.setScaleY(0.5f);
    close.setId((int) Math.random());

    LinearLayout.LayoutParams closeLayout = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    close.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            CollaborativeDishLayout.this.setVisibility(GONE);
        }
    });
    addView(close, closeLayout);

    Space space6 = new Space(context);
    LinearLayout.LayoutParams space6Layout = new LinearLayout.LayoutParams(15, ViewGroup.LayoutParams.MATCH_PARENT);
    addView(space6, space6Layout);

}
项目:blunch_android    文件:PaymentDishLayout.java   
public PaymentDishLayout(Context context) {
    super(context);
    setOrientation(VERTICAL);
    setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));

    int margin12 = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 12, getResources().getDisplayMetrics());

    //H1

    final LinearLayout h1 = new LinearLayout(context);
    h1.setOrientation(HORIZONTAL);

    dishName = new EditText(context);
    dishName.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    dishName.setTextColor(getResources().getColor(R.color.black));
    dishName.setHint("Nombre");
    dishName.setHintTextColor(getResources().getColor(R.color.gray));
    dishName.setTextSize(20);
    dishName.setInputType(InputType.TYPE_TEXT_FLAG_CAP_SENTENCES);
    LinearLayout.LayoutParams nomPlatLayout = new LinearLayout.LayoutParams(400, ViewGroup.LayoutParams.WRAP_CONTENT);
    nomPlatLayout.setMargins(margin12, 0, 0, 0);
    h1.addView(dishName, nomPlatLayout);


    Space space5 = new Space(context);
    LinearLayout.LayoutParams space5Layout = new LinearLayout.LayoutParams(8, ViewGroup.LayoutParams.MATCH_PARENT);
    h1.addView(space5, space5Layout);

    priceDish = new EditText(context);
    priceDish.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_DECIMAL);
    priceDish.setTextSize(TypedValue.COMPLEX_UNIT_SP, 30);
    priceDish.setTextColor(getResources().getColor(R.color.black));
    priceDish.setHint("Precio");
    priceDish.setHintTextColor(getResources().getColor(R.color.gray));
    priceDish.setTextSize(20);
    LinearLayout.LayoutParams priceDishLayout = new LinearLayout.LayoutParams(160, ViewGroup.LayoutParams.WRAP_CONTENT);

    h1.addView(priceDish, priceDishLayout);

    Space space6 = new Space(context);
    LinearLayout.LayoutParams space6Layout = new LinearLayout.LayoutParams(2, ViewGroup.LayoutParams.WRAP_CONTENT);
    h1.addView(space6, space6Layout);

    eur = new TextView(context);
    eur.setText("€");
    eur.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
    eur.setTextColor(getResources().getColor(R.color.gray));
    LinearLayout.LayoutParams eurLayout = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);

    h1.addView(eur, eurLayout);

    Space space7 = new Space(context);
    LinearLayout.LayoutParams space7Layout = new LinearLayout.LayoutParams(20, ViewGroup.LayoutParams.WRAP_CONTENT);
    h1.addView(space7, space7Layout);

    close = new ImageButton(context);
    close.setBackgroundColor(getResources().getColor(R.color.white));
    close.setImageResource(R.drawable.cross);
    close.setScaleType(ImageView.ScaleType.FIT_XY);
    close.setScaleX(0.5f);
    close.setScaleY(0.5f);
    close.setId((int) Math.random());

    LinearLayout.LayoutParams closeLayout = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    close.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
           PaymentDishLayout.this.setVisibility(GONE);
        }
    });
    h1.addView(close, closeLayout);

    LinearLayout.LayoutParams h1Layout = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    this.addView(h1, h1Layout);
}
项目:stroll_safe    文件:MainActivity.java   
public void changeMode(Mode newMode) {
    if (mode == Mode.LICENSE)
        return;

    mode = newMode;

    if (releasedTimedThread != null)
        releasedTimedThread.forciblyStop();

    TextView headerText = (TextView) findViewById(R.id.headerText);
    TextView subText = (TextView) findViewById(R.id.subText);
    Space space1 = (Space) findViewById(R.id.space1);
    ProgressBar progressBar = (ProgressBar) findViewById(R.id.progressBar);
    ImageButton closeButton = (ImageButton) findViewById(R.id.closeButton);
    TextView middleText = (TextView) findViewById(R.id.middleText);
    Space space2 = (Space) findViewById(R.id.space2);
    ImageButton mainButton = (ImageButton) findViewById(R.id.mainButton);
    TextView bottomText = (TextView) findViewById(R.id.bottomText);
    Space space3 = (Space) findViewById(R.id.space3);
    int fingerId = getResources().getIdentifier("@drawable/finger_icon", null, getPackageName());
    int shakeId = getResources().getIdentifier("@drawable/shake_icon", null, getPackageName());
    switch (mode) {
        case MAIN:
            headerText.setText("Stroll Safe");
            subText.setText("Keeping You Safe on Late Night Strolls");
            space1.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
            progressBar.setVisibility(View.GONE);
            closeButton.setVisibility(View.GONE);
            middleText.setVisibility(View.GONE);
            space2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 0f));
            mainButton.setImageDrawable(getResources().getDrawable(fingerId));
            bottomText.setText("Press and Hold to Arm");
            bottomText.setVisibility(View.VISIBLE);
            space3.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 0f));
            break;

        case RELEASE:
            headerText.setText("Release Mode");
            subText.setText("Release Thumb to Contact Police");
            space1.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
            progressBar.setVisibility(View.GONE);
            closeButton.setVisibility(View.GONE);
            middleText.setVisibility(View.GONE);
            space2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 0f));
            mainButton.setImageDrawable(getResources().getDrawable(shakeId));
            bottomText.setText("Slide Thumb and Release to Enter Shake Mode");
            bottomText.setVisibility(View.VISIBLE);
            space3.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 3f));
            break;

        case SHAKE:
            headerText.setText("Shake Mode");
            subText.setText("Shake Phone to Contact Police");
            space1.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
            progressBar.setVisibility(View.GONE);
            closeButton.setVisibility(View.VISIBLE);
            middleText.setText("Press and Hold to Exit the App");
            middleText.setVisibility(View.VISIBLE);
            space2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
            mainButton.setImageDrawable(getResources().getDrawable(fingerId));
            bottomText.setText("Press and Hold to Enter Release Mode");
            bottomText.setVisibility(View.VISIBLE);
            space3.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 0f));
            break;

        case THUMB:
            headerText.setText("Thumb Released");
            subText.setText("Press and Hold Button to Cancel");
            space1.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
            progressBar.setVisibility(View.VISIBLE);
            closeButton.setVisibility(View.GONE);
            middleText.setVisibility(View.VISIBLE);
            space2.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f));
            mainButton.setImageDrawable(getResources().getDrawable(fingerId));
            bottomText.setVisibility(View.GONE);
            space3.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 0f));
            HandleThumbReleased();
            break;
    }
}
项目:marketcloud-sample-android-application    文件:HomeFragment.java   
public void loadCategoryCards() {

        //save the data for future uses
        MainActivity.categoryList = name;
        MainActivity.categoryIDs = id;

        //hide the progress bar
        pb.setVisibility(View.GONE);

        //create a layout inflater
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        //iterate over reach category
        for (int i = 0; i < count; i++) {

            //create a card view for each category
            CardView cv = (CardView) inflater.inflate(R.layout.card_layout, ll, false);

            final int finalI = i;

            //associate a listener to it
            cv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //pass the category ID as bundle data: this will allow us to easily retrieve the ID when the card
                    //is tapped and use it
                    Bundle bundle = new Bundle();
                    bundle.putInt("category_id", id[finalI]);

                    //associate the loading of a list fragment to the tap
                    Fragment newFragment = new ListFragment();
                    newFragment.setArguments(bundle);
                    getFragmentManager()
                            .beginTransaction()
                            .replace(R.id.frame, newFragment)
                            .commit();
                }
            });

            //add the card view to the layout
            ll.addView(cv);

            //add a space between the cards
            if (i != count-1) {
                Space space = (Space) inflater.inflate(R.layout.spaaaaaaaaace_im_in_space, ll, false);

                ll.addView(space);
            }

            //create a reference to the view items
            ImageView img = (ImageView) cv.findViewById(R.id.imageView2);
            TextView tv = (TextView) cv.findViewById(R.id.textView3);

            //fill them
            img.setImageBitmap(slideshow[i]);
            tv.setText(name[i]);
        }

        //show the cards
        ll.setVisibility(View.VISIBLE);
    }
项目:marketcloud-sample-android-application    文件:HomeFragment.java   
public void loadProductCards() {

        //hide the progress bar
        pb2.setVisibility(View.GONE);

        //create a layout inflater
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        //iterate over reach product
        for (int i = 0; i < count2; i++) {

            //create a card view for each product
            CardView cv = (CardView) inflater.inflate(R.layout.card_layout, ll2, false);

            final int finalI = i;

            //associate a listener to it
            cv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    //pass the product ID as bundle data: this will allow us to easily retrieve the ID when the card
                    //is tapped and use it
                    Bundle bundle = new Bundle();
                    bundle.putInt("id", id2[finalI]);

                    //associate the loading of a list fragment to the tap
                    Fragment newFragment = new ListFragment();
                    newFragment.setArguments(bundle);
                    getFragmentManager()
                            .beginTransaction()
                            .replace(R.id.frame, newFragment)
                            .commit();
                }
            });

            //add the card view to the layout
            ll2.addView(cv);

            //add a space between the cards
            if (i != count2-1) {
                Space space = (Space) inflater.inflate(R.layout.spaaaaaaaaace_im_in_space, ll2, false);

                ll2.addView(space);
            }

            //create a reference to the view items
            ImageView img = (ImageView) cv.findViewById(R.id.imageView2);
            TextView tv = (TextView) cv.findViewById(R.id.textView3);

            //fill them
            img.setImageBitmap(slideshow2[i]);
            tv.setText(name2[i]);
        }

        //show the cards
        ll2.setVisibility(View.VISIBLE);
    }
项目:365browser    文件:TabularContextMenuListAdapter.java   
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ContextMenuItem menuItem = mMenuItems.get(position);
    ViewHolderItem viewHolder;

    if (convertView == null) {
        LayoutInflater inflater = LayoutInflater.from(mActivity);
        convertView = inflater.inflate(R.layout.tabular_context_menu_row, null);

        viewHolder = new ViewHolderItem();
        viewHolder.mIcon = (ImageView) convertView.findViewById(R.id.context_menu_icon);
        viewHolder.mText = (TextView) convertView.findViewById(R.id.context_text);
        viewHolder.mShareIcon =
                (ImageView) convertView.findViewById(R.id.context_menu_share_icon);
        viewHolder.mRightPadding =
                (Space) convertView.findViewById(R.id.context_menu_right_padding);

        convertView.setTag(viewHolder);
    } else {
        viewHolder = (ViewHolderItem) convertView.getTag();
    }

    viewHolder.mText.setText(menuItem.getTitle(mActivity));
    Drawable icon = menuItem.getDrawable(mActivity);
    viewHolder.mIcon.setImageDrawable(icon);
    viewHolder.mIcon.setVisibility(icon != null ? View.VISIBLE : View.INVISIBLE);

    if (menuItem == ChromeContextMenuItem.SHARE_IMAGE) {
        Intent shareIntent = ShareHelper.getShareImageIntent(null);
        final Pair<Drawable, CharSequence> shareInfo =
                ShareHelper.getShareableIconAndName(mActivity, shareIntent);
        if (shareInfo.first != null) {
            viewHolder.mShareIcon.setImageDrawable(shareInfo.first);
            viewHolder.mShareIcon.setVisibility(View.VISIBLE);
            viewHolder.mShareIcon.setContentDescription(mActivity.getString(
                    R.string.accessibility_menu_share_via, shareInfo.second));
            viewHolder.mShareIcon.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View view) {
                    mOnDirectShare.run();
                }
            });
            viewHolder.mRightPadding.setVisibility(View.GONE);
        }
    } else {
        viewHolder.mShareIcon.setVisibility(View.GONE);
        viewHolder.mRightPadding.setVisibility(View.VISIBLE);
    }

    return convertView;
}
项目:RecifeBomDeBola    文件:DatePicker.java   
private void render() {
    //Get inflater for view
    LayoutInflater inflater = LayoutInflater.from(mContext);
    mDaysContainer.removeAllViews();

    //Add left padding
    mLeftSpace = new Space(mContext);
    mDaysContainer.addView(mLeftSpace);

    //Cycle from start day
    LocalDateTime startDate = mStartDate;
    LocalDateTime endDate = mEndDate;

    while (startDate.isBefore(endDate.plusDays(1))) {

        //Inflate view
        LinearLayout view = (LinearLayout) inflater.inflate(com.adrielcafe.recifebomdebola.R.layout.date_picker_day, mDaysContainer, false);

        //new DayView
        DayView dayView = new DayView(view);

        //Set texts and listener
        dayView.setDayOfWeek(startDate.dayOfWeek().getAsShortText().substring(0, 3));
        if(!mDisplayDayOfWeek)
            dayView.hideDayOfWeek();

        dayView.setDay(startDate.getDayOfMonth());
        dayView.setMonth(startDate.getMonthOfYear());
        dayView.setYear(startDate.getYear());
        dayView.setMonthShortName(startDate.monthOfYear().getAsShortText().substring(0,3));

        //Hide month if range in same month
        if (!mAlwaysDisplayMonth && startDate.getMonthOfYear() == endDate.getMonthOfYear())
            dayView.hideMonthShortName();

        //Set style
        dayView.setTextColor(mDayTextColor);

        //Set listener
        dayView.setOnClickListener(this);

        //Add to container
        mDaysContainer.addView(dayView.getView());

        //Next day
        startDate = startDate.plusDays(1);
    }

    //Add right padding
    mRightSpace = new Space(mContext);
    mDaysContainer.addView(mRightSpace);
}
项目:incant    文件:WindowBlank.java   
@Override
View createView(Context context) {
    return new Space(context);
}
项目:openScale    文件:MeasurementView.java   
private void initView(Context context) {
    measurementRow = new TableRow(context);

    iconView = new ImageView(context);
    nameView = new TextView(context);
    valueView = new TextView(context);
    editModeView = new ImageView(context);
    indicatorView = new ImageView(context);

    evaluatorRow = new TableRow(context);
    evaluatorView = new LinearGaugeView(context);

    incDecLayout = new LinearLayout(context);

    measurementRow.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT, 1.0f));
    measurementRow.setGravity(Gravity.CENTER);
    measurementRow.addView(iconView);
    measurementRow.addView(nameView);
    measurementRow.addView(valueView);
    measurementRow.addView(incDecLayout);
    measurementRow.addView(editModeView);
    measurementRow.addView(indicatorView);

    addView(measurementRow);
    addView(evaluatorRow);

    iconView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    iconView.setPadding(20,0,20,0);
    iconView.setColorFilter(nameView.getCurrentTextColor());

    nameView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
    nameView.setLines(2);
    nameView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.55f));

    valueView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 15);
    valueView.setGravity(Gravity.RIGHT | Gravity.CENTER);
    valueView.setPadding(0,0,20,0);
    valueView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.29f));

    incDecLayout.setOrientation(VERTICAL);
    incDecLayout.setVisibility(View.GONE);
    incDecLayout.setPadding(0,0,0,0);
    incDecLayout.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.MATCH_PARENT, 0.05f));

    editModeView.setImageDrawable(ContextCompat.getDrawable(context, R.drawable.ic_editable));
    editModeView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
    editModeView.setVisibility(View.GONE);
    editModeView.setColorFilter(nameView.getCurrentTextColor());

    indicatorView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.MATCH_PARENT, 0.01f));
    indicatorView.setBackgroundColor(Color.GRAY);

    evaluatorRow.setLayoutParams(new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,LayoutParams.WRAP_CONTENT, 1.0f));
    evaluatorRow.addView(new Space(context));
    evaluatorRow.addView(evaluatorView);
    Space spaceAfterEvaluatorView = new Space(context);
    evaluatorRow.addView(spaceAfterEvaluatorView);
    evaluatorRow.setVisibility(View.GONE);

    evaluatorView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.99f));
    spaceAfterEvaluatorView.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 0.01f));

    onClickListenerEvaluation onClickListener = new onClickListenerEvaluation();
    measurementRow.setOnClickListener(onClickListener);
    evaluatorRow.setOnClickListener(onClickListener);
}
项目:AutoGapLinearLayout    文件:AutoGapLinearLayout.java   
private Space generateGap() {
    if (LOG_PRIORITY <= Log.VERBOSE) Log.v(LOG_TAG, "generateGap()");
    return new Space(getContext());
}