Java Code Examples for android.widget.RelativeLayout#setBackgroundColor()
The following examples show how to use
android.widget.RelativeLayout#setBackgroundColor() .
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: MainFragment.java From duo-navigation-drawer with Apache License 2.0 | 6 votes |
@Override public Object instantiateItem(ViewGroup container, int position) { // Create some layout params RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); layoutParams.addRule(RelativeLayout.CENTER_IN_PARENT, RelativeLayout.TRUE); // Create some text TextView textView = getTextView(container.getContext()); textView.setText(String.valueOf(position)); textView.setLayoutParams(layoutParams); RelativeLayout layout = new RelativeLayout(container.getContext()); layout.setBackgroundColor(ContextCompat.getColor(container.getContext(), R.color.colorPrimary)); layout.setLayoutParams(layoutParams); layout.addView(textView); container.addView(layout); return layout; }
Example 2
Source File: WXSingleCropControllerView.java From YImagePicker with Apache License 2.0 | 6 votes |
@Override protected void initView(View view) { RelativeLayout mTitleBar = view.findViewById(R.id.mTitleBar); ImageView mIvBack = view.findViewById(R.id.iv_back); mTitle=view.findViewById(R.id.tv_title); mCompleteBtn = view.findViewById(R.id.tv_rightBtn); mTitleBar.setBackgroundColor(Color.WHITE); mCompleteBtn.setBackground(PCornerUtils.cornerDrawable(ImagePicker.getThemeColor(), dp(2))); mIvBack.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { onBackPressed(); } }); mCompleteBtn.setText(getContext().getString(R.string.picker_str_title_crop_right)); mTitle.setText(getContext().getString(R.string.picker_str_title_crop)); }
Example 3
Source File: VerticalRecyclerViewAdapter.java From Android-Timeline-View with MIT License | 6 votes |
public VerticalRecyclerViewHolder(View view) { super(view); time = (TextView) view.findViewById(R.id.tv_timeline_time); header = (TextView) view.findViewById(R.id.tv_timeline_header); header.setVisibility(View.INVISIBLE); timelineindicator_container = (RelativeLayout) view.findViewById(R.id.container_timeline_indicator); timelineindicator_line = (TextView) view.findViewById(R.id.tv_timeline_indicator_line); /*apply configs*/ time.setTextColor(Color.parseColor(TimeLineConfig.getTimelineHeaderTextColour())); time.setTextSize(TimeLineConfig.getTimelineHeaderSize()); timelineindicator_line.setBackgroundColor(Color.parseColor(TimeLineConfig.getTimelineIndicatorLineColour())); timelineindicator_container.setBackgroundColor(Color.parseColor(TimeLineConfig.getTimelineIndicatorBackgroundColour())); recyclerView = (RecyclerView) view.findViewById(R.id.rv_horizontal_timeline); LinearLayoutManager recyclerViewLayoutManager = new LinearLayoutManager(context); recyclerView.setLayoutManager(recyclerViewLayoutManager); LinearLayoutManager horizontalLinearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false); recyclerView.setLayoutManager(horizontalLinearLayoutManager); }
Example 4
Source File: CommentImageGrid.java From CommentGallery with Apache License 2.0 | 6 votes |
private ViewGroup generateImageLayout() { SquareDraweeView imageView = new SquareDraweeView(mContext); GenericDraweeHierarchyBuilder builder = new GenericDraweeHierarchyBuilder(mContext.getResources()); GenericDraweeHierarchy hierarchy = builder .setFadeDuration(300).setActualImageScaleType(ScalingUtils.ScaleType.CENTER_CROP) .build(); if (mPlaceholderImageResId > 0) { hierarchy.setPlaceholderImage(mPlaceholderImageResId); } if (mFailureImageResId > 0) { hierarchy.setFailureImage(mFailureImageResId); } imageView.setHierarchy(hierarchy); RelativeLayout.LayoutParams imgLp = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT); imgLp.setMargins(mImageBorderThickness, mImageBorderThickness, mImageBorderThickness, mImageBorderThickness); RelativeLayout mainLayout = new RelativeLayout(mContext); mainLayout.setBackgroundColor(mImageBorderColor); mainLayout.addView(imageView, imgLp); return mainLayout; }
Example 5
Source File: BrowseMapActivity.java From mappwidget with Apache License 2.0 | 5 votes |
private void initMap(Bundle savedInstanceState) { // In order to display the map on the screen you will need // to initialize widget and place it into layout. map = new MapWidget(savedInstanceState, this, "map", // root name of the map under assets folder. 10); // initial zoom level map.setId(MAP_ID); OfflineMapConfig config = map.getConfig(); config.setPinchZoomEnabled(true); // Sets pinch gesture to zoom config.setFlingEnabled(true); // Sets inertial scrolling of the map config.setMaxZoomLevelLimit(20); config.setZoomBtnsVisible(true); // Sets embedded zoom buttons visible // Configuration of GPS receiver GPSConfig gpsConfig = config.getGpsConfig(); gpsConfig.setPassiveMode(false); gpsConfig.setGPSUpdateInterval(500, 5); // Configuration of position marker MapGraphicsConfig graphicsConfig = config.getGraphicsConfig(); graphicsConfig.setAccuracyAreaColor(0x550000FF); // Blue with transparency graphicsConfig.setAccuracyAreaBorderColor(Color.BLUE); // Blue without transparency RelativeLayout layout = (RelativeLayout) findViewById(R.id.rootLayout); // Adding the map to the layout layout.addView(map, 0); layout.setBackgroundColor(Color.parseColor("#0049FF")); // Adding layers in order to put there some map objects map.createLayer(LAYER1_ID); // you will need layer id's in order to access particular layer map.createLayer(LAYER2_ID); }
Example 6
Source File: WeiboDialog.java From MiBandDecompiled with Apache License 2.0 | 5 votes |
private void initWindow() { requestWindowFeature(1); getWindow().setFeatureDrawableAlpha(0, 0); getWindow().setSoftInputMode(16); mRootContainer = new RelativeLayout(getContext()); mRootContainer.setBackgroundColor(0); addContentView(mRootContainer, new android.view.ViewGroup.LayoutParams(-1, -1)); }
Example 7
Source File: EditPagePort.java From HHComicViewer with Apache License 2.0 | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = R.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example 8
Source File: EditPagePort.java From YiZhi with Apache License 2.0 | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = ResHelper.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example 9
Source File: EditPagePort.java From enjoyshop with Apache License 2.0 | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = ResHelper.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example 10
Source File: EditPagePort.java From LiuAGeAndroid with MIT License | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = ResHelper.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example 11
Source File: ImgSelActivity.java From youqu_master with Apache License 2.0 | 5 votes |
private void initView() { rlTitleBar = (RelativeLayout) findViewById(R.id.rlTitleBar); tvTitle = (TextView) findViewById(R.id.tvTitle); btnConfirm = (Button) findViewById(R.id.btnConfirm); btnConfirm.setOnClickListener(this); ivBack = (ImageView) findViewById(R.id.ivBack); ivBack.setOnClickListener(this); if (config != null) { if (config.backResId != -1) { ivBack.setImageResource(config.backResId); } if (config.statusBarColor != -1) { StatusBarCompat.compat(this, config.statusBarColor); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); } } rlTitleBar.setBackgroundColor(config.titleBgColor); tvTitle.setTextColor(config.titleColor); tvTitle.setText(config.title); btnConfirm.setBackgroundColor(config.btnBgColor); btnConfirm.setTextColor(config.btnTextColor); } }
Example 12
Source File: EditPagePort.java From MyHearts with Apache License 2.0 | 5 votes |
public void onCreate() { super.onCreate(); int screenHeight = R.getScreenHeight(activity); float ratio = ((float) screenHeight) / DESIGN_SCREEN_HEIGHT; maxBodyHeight = 0; llPage = new LinearLayout(activity); llPage.setOrientation(LinearLayout.VERTICAL); activity.setContentView(llPage); rlTitle = new RelativeLayout(activity); rlTitle.setBackgroundColor(0xffe6e9ec); int titleHeight = (int) (DESIGN_TITLE_HEIGHT * ratio); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, titleHeight); llPage.addView(rlTitle, lp); initTitle(rlTitle, ratio); RelativeLayout rlBody = new RelativeLayout(activity); rlBody.setBackgroundColor(0xffffffff); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(rlBody, lp); initBody(rlBody, ratio); LinearLayout llShadow = new LinearLayout(activity); llShadow.setOrientation(LinearLayout.VERTICAL); rlBody.addView(llShadow, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); initShadow(llShadow, ratio); llBottom = new LinearLayout(activity); llBottom.setOrientation(LinearLayout.VERTICAL); lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llPage.addView(llBottom, lp); initBottom(llBottom, ratio); }
Example 13
Source File: CustomKeyboardButtonAdapter.java From XMouse with MIT License | 4 votes |
@Override public View getView(int position, View convertView, ViewGroup parent) { final ItemViewHolder itemViewHolder; if (convertView == null) { convertView = mLayoutInflater.inflate(R.layout.keyboard_button, parent, false); itemViewHolder = new ItemViewHolder(); itemViewHolder.itemTitle = (TextView) convertView.findViewById(R.id.textViewTitle); //itemViewHolder.itemCommand = (TextView) convertView.findViewById(R.id.MarqueeText); //itemViewHolder.itemIcon = (ImageView) convertView.findViewById(R.id.imageViewIcon); convertView.setTag(itemViewHolder); } else { itemViewHolder = (ItemViewHolder) convertView.getTag(); } final CustomKeyboardButton item = getItem(position); SpanVariableGridView.LayoutParams lp = new LayoutParams(convertView.getLayoutParams()); lp.span = item.getmSpans(); convertView.setLayoutParams(lp); itemViewHolder.itemTitle.setText(item.getmTitle()); //if(MainActivity.setting_keyboard_show_details){ // itemViewHolder.itemCommand.setText(item.getmCommand()); // itemViewHolder.itemCommand.setSelected(true); //} final RelativeLayout layoutHolder = (RelativeLayout) convertView.findViewById(R.id.textViewHolderLayout); try{ layoutHolder.setBackgroundColor(Color.parseColor(item.getmColor())); }catch(Exception e){ e.printStackTrace(); Toast.makeText(mContext, "Error parsing new layout: " + e.getMessage() + " " + item.getmColor(), Toast.LENGTH_SHORT).show(); } //itemViewHolder.itemIcon.setImageResource(keyboard_button.getIcon()); /*convertView.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { //String ac = ""; switch (event.getAction()) { case MotionEvent.ACTION_DOWN: //ac="down"; layoutHolder.setBackgroundColor(Color.parseColor("#00BFFF"));//lightblue break; case MotionEvent.ACTION_UP: //ac="up"; try{ layoutHolder.setBackgroundColor(Color.parseColor(item.getmColor())); }catch(Exception e){ e.printStackTrace(); Toast.makeText(mContext, "Error parsing new layout: " + e.getMessage() + " " + item.getmColor(), Toast.LENGTH_SHORT).show(); } break; } //MainActivity.recentCmdTextView.setText(ac); return false;//false=do not consume click event } });*/ convertView.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { MainActivity.conn.executeShellCommand(item.getmCommand()); //Toast.makeText(mContext, keyboard_button.getmCommand(), Toast.LENGTH_SHORT).show(); } }); return convertView; }
Example 14
Source File: EditPagePort.java From MyHearts with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.VERTICAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 15
Source File: EditPagePort.java From HHComicViewer with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.VERTICAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 16
Source File: EditPagePort.java From BaoKanAndroid with MIT License | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.VERTICAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT); llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.leftMargin = lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 17
Source File: EditPageLand.java From BaoKanAndroid with MIT License | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 18
Source File: EditPageLand.java From HHComicViewer with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 19
Source File: EditPageLand.java From YiZhi with Apache License 2.0 | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }
Example 20
Source File: EditPageLand.java From LiuAGeAndroid with MIT License | 4 votes |
private void initBody(RelativeLayout rlBody, float ratio) { svContent = new ScrollView(activity); rlBody.addView(svContent, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); LinearLayout llContent = new LinearLayout(activity); llContent.setOrientation(LinearLayout.HORIZONTAL); svContent.addView(llContent, new ScrollView.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)); etContent = new EditText(activity); int padding = (int) (DESIGN_LEFT_PADDING * ratio); etContent.setPadding(padding, padding, padding, padding); etContent.setBackgroundDrawable(null); etContent.setTextColor(0xff3b3b3b); etContent.setTextSize(TypedValue.COMPLEX_UNIT_SP, 21); etContent.setText(sp.getText()); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(0, LayoutParams.WRAP_CONTENT); lp.weight = 1; llContent.addView(etContent, lp); etContent.addTextChangedListener(this); rlThumb = new RelativeLayout(activity); rlThumb.setBackgroundColor(0xff313131); int thumbWidth = (int) (DESIGN_THUMB_HEIGHT_L * ratio); int xWidth = (int) (DESIGN_REMOVE_THUMB_HEIGHT_L * ratio); lp = new LinearLayout.LayoutParams(thumbWidth, thumbWidth); lp.rightMargin = lp.bottomMargin = lp.topMargin = padding; llContent.addView(rlThumb, lp); aivThumb = new AsyncImageView(activity) { public void onImageGot(String url, Bitmap bm) { thumb = bm; super.onImageGot(url, bm); } }; aivThumb.setScaleToCropCenter(true); RelativeLayout.LayoutParams rllp = new RelativeLayout.LayoutParams(thumbWidth, thumbWidth); rlThumb.addView(aivThumb, rllp); aivThumb.setOnClickListener(this); initThumb(aivThumb); xvRemove = new XView(activity); xvRemove.setRatio(ratio); rllp = new RelativeLayout.LayoutParams(xWidth, xWidth); rllp.addRule(RelativeLayout.ALIGN_PARENT_TOP); rllp.addRule(RelativeLayout.ALIGN_PARENT_RIGHT); rlThumb.addView(xvRemove, rllp); xvRemove.setOnClickListener(this); }