Java Code Examples for android.support.v7.widget.LinearLayoutCompat#LayoutParams

The following examples show how to use android.support.v7.widget.LinearLayoutCompat#LayoutParams . 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: BackgroundProgress.java    From BackgroundProgress with Apache License 2.0 5 votes vote down vote up
private void init(Context context, AttributeSet attrs) {
    TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.BackgroundProgress);
    try {
        showTxt = typedArray.getString(R.styleable.BackgroundProgress_showTxt);
        isGradient = typedArray.getBoolean(R.styleable.BackgroundProgress_isGradient, true);
    } catch (Exception e) {
        showTxt = null;
        isGradient = true;
    }

    typedArray.recycle();

    View view = LayoutInflater.from(context).inflate(R.layout.bp, null);

    backgroundProgressView = (BackgroundProgressView) view.findViewById(R.id.progress);
    tv = (TextView) view.findViewById(R.id.tv);

    if (TextUtils.isEmpty(showTxt)) {
        tv.setVisibility(GONE);
    } else {
        tv.setText(showTxt);
    }

    backgroundProgressView.set_isGradient(isGradient);


    ViewGroup.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    addView(view, layoutParams);
}
 
Example 2
Source File: AvlDirectCall.java    From iGap-Android with GNU Affero General Public License v3.0 5 votes vote down vote up
private View makeHeaderTextView(Context context) {

        TextView textView = new TextView(context);
        textView.setTextColor(Color.parseColor("#ffffff"));
        textView.setTextSize(TypedValue.COMPLEX_UNIT_PX, context.getResources().getDimension(R.dimen.dp16));
        LinearLayoutCompat.LayoutParams lp = new LinearLayoutCompat.LayoutParams(LinearLayoutCompat.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
        textView.setLayoutParams(lp);
        textView.setPadding(0, -(ViewMaker.i_Dp(R.dimen.dp6)), 0, -(ViewMaker.i_Dp(R.dimen.dp6)));
        textView.setText(R.string.md_expand_arrow);
        textView.setVisibility(INVISIBLE);
        textView.setTypeface(G.typeface_Fontico);


        return textView;
    }
 
Example 3
Source File: StatisticsAdapter.java    From BrainPhaser with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Called to create the ViewHolder at the given position.
 *
 * @param parent   parent to assign the newly created view to
 * @param viewType ignored
 */
@Override
public StatisticViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View v;
    int layout;

    Context parentContext = parent.getContext();

    if (viewType == StatisticViewHolder.TYPE_LARGE) {
        layout = R.layout.list_item_statistic_most_played;

    } else if (viewType == StatisticViewHolder.TYPE_SMALL) {
        layout = R.layout.list_item_statistic_pie_chart;
    } else {
        throw new RuntimeException("Invalid view type!");
    }

    v = LayoutInflater.from(parentContext).inflate(layout, parent, false);

    LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(
            LinearLayoutCompat.LayoutParams.MATCH_PARENT,
            LinearLayoutCompat.LayoutParams.WRAP_CONTENT);

    v.setLayoutParams(layoutParams);

    return new StatisticViewHolder(v, mUserLogicFactory, mChallengeDataSource, mApplication,
            mUser, mCategoryId);
}