android.support.v4.widget.Space Java Examples

The following examples show how to use android.support.v4.widget.Space. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnackbarUtils.java    From PicKing with Apache License 2.0 6 votes vote down vote up
/**
 * 设置TextView(@+id/snackbar_text)左右两侧的图片
 *
 * @param leftDrawable
 * @param rightDrawable
 * @return
 */
public SnackbarUtils leftAndRightDrawable(@Nullable Drawable leftDrawable, @Nullable Drawable rightDrawable) {
    if (getSnackbar() != null) {
        TextView message = (TextView) getSnackbar().getView().findViewById(R.id.snackbar_text);
        LinearLayout.LayoutParams paramsMessage = (LinearLayout.LayoutParams) message.getLayoutParams();
        paramsMessage = new LinearLayout.LayoutParams(paramsMessage.width, paramsMessage.height, 0.0f);
        message.setLayoutParams(paramsMessage);
        message.setCompoundDrawablePadding(message.getPaddingLeft());
        int textSize = (int) message.getTextSize();
        if (leftDrawable != null) {
            leftDrawable.setBounds(0, 0, textSize, textSize);
        }
        if (rightDrawable != null) {
            rightDrawable.setBounds(0, 0, textSize, textSize);
        }
        message.setCompoundDrawables(leftDrawable, null, rightDrawable, null);
        LinearLayout.LayoutParams paramsSpace = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f);
        ((Snackbar.SnackbarLayout) getSnackbar().getView()).addView(new Space(getSnackbar().getView().getContext()), 1, paramsSpace);
    }
    return this;
}
 
Example #2
Source File: SnackbarUtils.java    From SweetTips with Apache License 2.0 6 votes vote down vote up
/**
 * 设置TextView(@+id/snackbar_text)左右两侧的图片
 * @param leftDrawable
 * @param rightDrawable
 * @return
 */
public SnackbarUtils leftAndRightDrawable(@Nullable Drawable leftDrawable, @Nullable Drawable rightDrawable){
    if(getSnackbar()!=null){
        TextView message = (TextView) getSnackbar().getView().findViewById(R.id.snackbar_text);
        LinearLayout.LayoutParams paramsMessage = (LinearLayout.LayoutParams) message.getLayoutParams();
        paramsMessage = new LinearLayout.LayoutParams(paramsMessage.width, paramsMessage.height,0.0f);
        message.setLayoutParams(paramsMessage);
        message.setCompoundDrawablePadding(message.getPaddingLeft());
        int textSize = (int) message.getTextSize();
        Log.e("Jet","textSize:"+textSize);
        if(leftDrawable!=null){
            leftDrawable.setBounds(0,0,textSize,textSize);
        }
        if(rightDrawable!=null){
            rightDrawable.setBounds(0,0,textSize,textSize);
        }
        message.setCompoundDrawables(leftDrawable,null,rightDrawable,null);
        LinearLayout.LayoutParams paramsSpace = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT,1.0f);
        ((SweetSnackbar.SnackbarLayout)getSnackbar().getView()).addView(new Space(getSnackbar().getView().getContext()),1,paramsSpace);
    }
    return this;
}
 
Example #3
Source File: SnackbarUtils.java    From SnackbarUtils with Apache License 2.0 6 votes vote down vote up
/**
 * 设置TextView(@+id/snackbar_text)左右两侧的图片
 * @param leftDrawable
 * @param rightDrawable
 * @return
 */
public SnackbarUtils leftAndRightDrawable(@Nullable Drawable leftDrawable, @Nullable Drawable rightDrawable){
    if(getSnackbar()!=null){
        TextView message = (TextView) getSnackbar().getView().findViewById(R.id.snackbar_text);
        LinearLayout.LayoutParams paramsMessage = (LinearLayout.LayoutParams) message.getLayoutParams();
        paramsMessage = new LinearLayout.LayoutParams(paramsMessage.width, paramsMessage.height,0.0f);
        message.setLayoutParams(paramsMessage);
        message.setCompoundDrawablePadding(message.getPaddingLeft());
        int textSize = (int) message.getTextSize();
        Log.e("Jet","textSize:"+textSize);
        if(leftDrawable!=null){
            leftDrawable.setBounds(0,0,textSize,textSize);
        }
        if(rightDrawable!=null){
            rightDrawable.setBounds(0,0,textSize,textSize);
        }
        message.setCompoundDrawables(leftDrawable,null,rightDrawable,null);
        LinearLayout.LayoutParams paramsSpace = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT,1.0f);
        ((Snackbar.SnackbarLayout)getSnackbar().getView()).addView(new Space(getSnackbar().getView().getContext()),1,paramsSpace);
    }
    return this;
}
 
Example #4
Source File: SnackbarUtils.java    From SweetTips with Apache License 2.0 6 votes vote down vote up
/**
 * 设置TextView(@+id/snackbar_text)左右两侧的图片
 * @param leftDrawable
 * @param rightDrawable
 * @return
 */
public SnackbarUtils leftAndRightDrawable(@Nullable Drawable leftDrawable, @Nullable Drawable rightDrawable){
    if(getSnackbar()!=null){
        TextView message = (TextView) getSnackbar().getView().findViewById(R.id.snackbar_text);
        LinearLayout.LayoutParams paramsMessage = (LinearLayout.LayoutParams) message.getLayoutParams();
        paramsMessage = new LinearLayout.LayoutParams(paramsMessage.width, paramsMessage.height,0.0f);
        message.setLayoutParams(paramsMessage);
        message.setCompoundDrawablePadding(message.getPaddingLeft());
        int textSize = (int) message.getTextSize();
        Log.e("Jet","textSize:"+textSize);
        if(leftDrawable!=null){
            leftDrawable.setBounds(0,0,textSize,textSize);
        }
        if(rightDrawable!=null){
            rightDrawable.setBounds(0,0,textSize,textSize);
        }
        message.setCompoundDrawables(leftDrawable,null,rightDrawable,null);
        LinearLayout.LayoutParams paramsSpace = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT,1.0f);
        ((SweetSnackbar.SnackbarLayout)getSnackbar().getView()).addView(new Space(getSnackbar().getView().getContext()),1,paramsSpace);
    }
    return this;
}
 
Example #5
Source File: MessageInput.java    From ChatKit with Apache License 2.0 5 votes vote down vote up
private void init(Context context) {
    inflate(context, R.layout.view_message_input, this);

    messageInput = (EditText) findViewById(R.id.messageInput);
    messageSendButton = (ImageButton) findViewById(R.id.messageSendButton);
    attachmentButton = (ImageButton) findViewById(R.id.attachmentButton);
    sendButtonSpace = (Space) findViewById(R.id.sendButtonSpace);
    attachmentButtonSpace = (Space) findViewById(R.id.attachmentButtonSpace);

    messageSendButton.setOnClickListener(this);
    attachmentButton.setOnClickListener(this);
    messageInput.addTextChangedListener(this);
    messageInput.setText("");
    messageInput.setOnFocusChangeListener(this);
}
 
Example #6
Source File: SupportCoreUiDSL.java    From anvil with MIT License 4 votes vote down vote up
public static BaseDSL.ViewClassResult space() {
  return BaseDSL.v(Space.class);
}
 
Example #7
Source File: SupportCoreUiDSL.java    From anvil with MIT License 4 votes vote down vote up
public static Void space(Anvil.Renderable r) {
  return BaseDSL.v(Space.class, r);
}