android.widget.RelativeLayout#setBackgroundColor ( )源码实例Demo

下面列出了android.widget.RelativeLayout#setBackgroundColor ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: duo-navigation-drawer   文件: MainFragment.java
@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;
}
 
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);
}
 
源代码3 项目: CommentGallery   文件: CommentImageGrid.java
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;
}
 
源代码4 项目: YImagePicker   文件: WXSingleCropControllerView.java
@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));
}
 
源代码5 项目: MyHearts   文件: EditPagePort.java
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);
}
 
源代码6 项目: youqu_master   文件: ImgSelActivity.java
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);
    }
}
 
源代码7 项目: LiuAGeAndroid   文件: EditPagePort.java
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);
}
 
源代码8 项目: enjoyshop   文件: EditPagePort.java
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);
}
 
源代码9 项目: YiZhi   文件: EditPagePort.java
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);
}
 
源代码10 项目: HHComicViewer   文件: EditPagePort.java
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);
}
 
源代码11 项目: MiBandDecompiled   文件: WeiboDialog.java
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));
}
 
源代码12 项目: mappwidget   文件: BrowseMapActivity.java
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);
}
 
源代码13 项目: LiuAGeAndroid   文件: EditPageLand.java
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);
}
 
源代码14 项目: MyHearts   文件: EditPagePort.java
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);
}
 
源代码15 项目: XMouse   文件: CustomKeyboardButtonAdapter.java
@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;
}
 
源代码16 项目: HHComicViewer   文件: EditPagePort.java
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);
}
 
源代码17 项目: BaoKanAndroid   文件: EditPagePort.java
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);
}
 
源代码18 项目: BaoKanAndroid   文件: EditPageLand.java
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);
}
 
源代码19 项目: HHComicViewer   文件: EditPageLand.java
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);
}
 
源代码20 项目: YiZhi   文件: EditPageLand.java
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);
}