Search in sources :

Example 76 with LinearLayout

use of android.widget.LinearLayout in project android-topeka by googlesamples.

the class FillTwoBlanksQuizView method createQuizContentView.

@Override
protected View createQuizContentView() {
    LinearLayout layout = new LinearLayout(getContext());
    layout.setOrientation(LinearLayout.VERTICAL);
    mAnswerOne = createEditText();
    mAnswerOne.setImeOptions(EditorInfo.IME_ACTION_NEXT);
    mAnswerTwo = createEditText();
    mAnswerTwo.setId(R.id.quiz_edit_text_two);
    addEditText(layout, mAnswerOne);
    addEditText(layout, mAnswerTwo);
    return layout;
}
Also used : LinearLayout(android.widget.LinearLayout)

Example 77 with LinearLayout

use of android.widget.LinearLayout in project AndroidPicker by gzu-liyujiang.

the class StatusBar method translucent.

/**
     * 此方法需在setContentView之后调用
     *
     * @param activity Activity
     * @param color    颜色
     */
public static void translucent(Activity activity, @ColorInt int color) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        //Android4.4以下不支持沉浸式状态栏
        return;
    }
    LogUtils.verbose("let status bar immersion by color" + color);
    ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    View immersionView = decorView.findViewById(IMMERSION_ID);
    if (null != immersionView) {
        LogUtils.verbose("status bar has immersion");
        return;
    }
    View contentView = decorView.getChildAt(0);
    //The specified child already has a parent. You must call removeView() on the child's parent first.
    decorView.removeView(contentView);
    LinearLayout layout = new LinearLayout(activity);
    layout.setId(IMMERSION_ID);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setBackgroundColor(color);
    //打桩一个和状态栏高度一致的视图
    View stubView = new View(activity);
    int width = LinearLayout.LayoutParams.MATCH_PARENT;
    int height = obtainHeight(activity);
    stubView.setLayoutParams(new LinearLayout.LayoutParams(width, height));
    layout.addView(stubView);
    layout.addView(contentView);
    decorView.addView(layout);
    translucent(activity, contentView);
}
Also used : ViewGroup(android.view.ViewGroup) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 78 with LinearLayout

use of android.widget.LinearLayout in project AndroidPicker by gzu-liyujiang.

the class ColorPicker method makeCenterView.

@Override
@NonNull
protected LinearLayout makeCenterView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    rootLayout.setOrientation(LinearLayout.VERTICAL);
    multiColorView = new ColorPanelView(activity);
    multiColorView.setId(MULTI_ID);
    multiColorView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
    Drawable cursorTopDrawable = ConvertUtils.toDrawable(ColorPickerIcon.getCursorTop());
    multiColorView.setPointerDrawable(cursorTopDrawable);
    multiColorView.setOnColorChangedListener(new ColorPanelView.OnColorChangedListener() {

        @Override
        public void onColorChanged(ColorPanelView view, int color) {
            updateCurrentColor(color);
        }
    });
    rootLayout.addView(multiColorView);
    blackColorView = new ColorPanelView(activity);
    blackColorView.setId(BLACK_ID);
    blackColorView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, ConvertUtils.toPx(activity, 30)));
    Drawable cursorBottomDrawable = ConvertUtils.toDrawable(ColorPickerIcon.getCursorBottom());
    blackColorView.setPointerDrawable(cursorBottomDrawable);
    blackColorView.setOnColorChangedListener(new ColorPanelView.OnColorChangedListener() {

        @Override
        public void onColorChanged(ColorPanelView view, int color) {
            updateCurrentColor(color);
        }
    });
    rootLayout.addView(blackColorView);
    return rootLayout;
}
Also used : ColorPanelView(cn.qqtheme.framework.widget.ColorPanelView) Drawable(android.graphics.drawable.Drawable) LinearLayout(android.widget.LinearLayout) NonNull(android.support.annotation.NonNull)

Example 79 with LinearLayout

use of android.widget.LinearLayout in project AndroidPicker by gzu-liyujiang.

the class ConfirmPopup method makeContentView.

/**
     * @see #makeHeaderView()
     * @see #makeCenterView()
     * @see #makeFooterView()
     */
@Override
protected final View makeContentView() {
    LinearLayout rootLayout = new LinearLayout(activity);
    rootLayout.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
    rootLayout.setBackgroundColor(backgroundColor);
    rootLayout.setOrientation(LinearLayout.VERTICAL);
    rootLayout.setGravity(Gravity.CENTER);
    rootLayout.setPadding(0, 0, 0, 0);
    rootLayout.setClipToPadding(false);
    View headerView = makeHeaderView();
    if (headerView != null) {
        rootLayout.addView(headerView);
    }
    if (topLineVisible) {
        View lineView = new View(activity);
        int height = ConvertUtils.toPx(activity, topLineHeight);
        lineView.setLayoutParams(new LinearLayout.LayoutParams(MATCH_PARENT, height));
        lineView.setBackgroundColor(topLineColor);
        rootLayout.addView(lineView);
    }
    rootLayout.addView(makeCenterView(), new LinearLayout.LayoutParams(MATCH_PARENT, 0, 1.0f));
    View footerView = makeFooterView();
    if (footerView != null) {
        rootLayout.addView(footerView);
    }
    return rootLayout;
}
Also used : TextView(android.widget.TextView) View(android.view.View) LinearLayout(android.widget.LinearLayout)

Example 80 with LinearLayout

use of android.widget.LinearLayout in project AndroidPicker by gzu-liyujiang.

the class PathAdapter method getView.

@Override
public View getView(final int position, View convertView, ViewGroup parent) {
    final Context context = parent.getContext();
    ViewHolder holder;
    if (convertView == null) {
        int matchParent = ViewGroup.LayoutParams.MATCH_PARENT;
        int wrapContent = ViewGroup.LayoutParams.WRAP_CONTENT;
        LinearLayout layout = new LinearLayout(context);
        layout.setOrientation(LinearLayout.HORIZONTAL);
        layout.setGravity(Gravity.CENTER_VERTICAL);
        // fixed: 17-1-8 #79 安卓4.x兼容问题,java.lang.ClassCastException……onMeasure……
        if (parent instanceof AbsListView) {
            layout.setLayoutParams(new AbsListView.LayoutParams(matchParent, matchParent));
        } else {
            layout.setLayoutParams(new ViewGroup.LayoutParams(matchParent, matchParent));
        }
        TextView textView = new TextView(context);
        LinearLayout.LayoutParams tvParams = new LinearLayout.LayoutParams(wrapContent, matchParent);
        textView.setLayoutParams(tvParams);
        textView.setGravity(Gravity.START | Gravity.CENTER_VERTICAL);
        int padding = ConvertUtils.toPx(context, 5);
        textView.setPadding(padding, 0, padding, 0);
        layout.addView(textView);
        ImageView imageView = new ImageView(context);
        int width = ConvertUtils.toPx(context, 20);
        imageView.setLayoutParams(new LinearLayout.LayoutParams(width, matchParent));
        imageView.setImageResource(android.R.drawable.ic_menu_report_image);
        layout.addView(imageView);
        convertView = layout;
        holder = new ViewHolder();
        holder.textView = textView;
        holder.imageView = imageView;
        convertView.setTag(holder);
    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    holder.textView.setText(paths.get(position));
    holder.imageView.setImageDrawable(arrowIcon);
    return convertView;
}
Also used : Context(android.content.Context) ViewGroup(android.view.ViewGroup) AbsListView(android.widget.AbsListView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

LinearLayout (android.widget.LinearLayout)1205 View (android.view.View)473 TextView (android.widget.TextView)455 ViewGroup (android.view.ViewGroup)203 ImageView (android.widget.ImageView)196 Button (android.widget.Button)167 ScrollView (android.widget.ScrollView)125 ListView (android.widget.ListView)100 LayoutInflater (android.view.LayoutInflater)90 FrameLayout (android.widget.FrameLayout)85 Context (android.content.Context)80 AdapterView (android.widget.AdapterView)74 EditText (android.widget.EditText)74 Intent (android.content.Intent)66 AbsListView (android.widget.AbsListView)58 LayoutParams (android.widget.LinearLayout.LayoutParams)48 RelativeLayout (android.widget.RelativeLayout)48 Bitmap (android.graphics.Bitmap)46 OnClickListener (android.view.View.OnClickListener)44 Drawable (android.graphics.drawable.Drawable)42