• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LayoutParams类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中android.widget.TableRow.LayoutParams的典型用法代码示例。如果您正苦于以下问题:Java LayoutParams类的具体用法?Java LayoutParams怎么用?Java LayoutParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LayoutParams类属于android.widget.TableRow包,在下文中一共展示了LayoutParams类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setAddButtonStyle

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
@SuppressWarnings("deprecation")
	protected void setAddButtonStyle(TextView text){
		TableRow.LayoutParams textViewParams = new TableRow.LayoutParams();
		Display display = getActivity().getWindowManager().getDefaultDisplay();
		Point size = new Point();
		display.getSize(size);
		int width = size.x;
		int height = size.y;
		textViewParams.height = height;
		textViewParams.width = width;
//		Log.d("width", "SCREEN.x == " + width);
		text.setMaxWidth(width);
		String uri = "@drawable/cell_shape_add";
		int imageResource = getResources().getIdentifier(uri, null, getActivity().getPackageName());
		Drawable res = getResources().getDrawable(imageResource);
		if (android.os.Build.VERSION.SDK_INT >= 16){
			text.setBackground(res);
		}
		else{
			text.setBackgroundDrawable(res);
		}
		text.setTextColor(getResources().getColor(R.color.own_grey));
		text.setSingleLine();
	}
 
开发者ID:FAU-Inf2,项目名称:rpgpack-android,代码行数:25,代码来源:TableFragment.java


示例2: BindTable

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
private void BindTable() {
    TableLayout tl = (TableLayout) findViewById(R.id.tblCurrency);
    if (tl == null)
        throw new NullPointerException("tl is null in BindTable (ActCurrency)!");
    tl.removeAllViews();
    LayoutInflater l = getActivity().getLayoutInflater();

    if (m_rgcsi == null)
        return;

    for (CurrencyStatusItem csi : m_rgcsi) {
        try {
            // TableRow tr = new TableRow(this);

            TableRow tr = (TableRow) l.inflate(R.layout.currencyrow, tl, false);
            TextView tvAttribute = tr.findViewById(R.id.txtCsiAttribute);
            TextView tvValue = tr.findViewById(R.id.txtCsiValue);
            TextView tvDiscrepancy = tr.findViewById(R.id.txtCsiDiscrepancy);

            tvAttribute.setText(csi.Attribute);
            tvValue.setText(csi.Value);
            tvDiscrepancy.setText(csi.Discrepancy);
            if (csi.Discrepancy.length() == 0)
                tvDiscrepancy.setVisibility(View.GONE);

            tvAttribute.setTextColor(Color.BLACK);
            tvDiscrepancy.setTextColor(Color.BLACK);
            if (csi.Status.compareTo("NotCurrent") == 0)
                tvValue.setTextColor(Color.RED);
            else if (csi.Status.compareTo("GettingClose") == 0)
                tvValue.setTextColor(Color.BLUE);
            else
                tvValue.setTextColor(Color.argb(255, 0, 128, 0));

            tl.addView(tr, new TableLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        } catch (NullPointerException ex) { // should never happen.
            Log.e(MFBConstants.LOG_TAG, Log.getStackTraceString(ex));
        }
    }
}
 
开发者ID:ericberman,项目名称:MyFlightbookAndroid,代码行数:41,代码来源:ActCurrency.java


示例3: onMeasure

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
protected void onMeasure(int paramInt1, int paramInt2)
{
  super.onMeasure(paramInt1, paramInt2);
  if ((this.mLabelsOn) && (!this.mBars.isEmpty()))
  {
    int i = 0;
    for (int j = 0; j < getChildCount(); j++)
    {
      View localView1 = getChildAt(j);
      if ((localView1 instanceof TableRow))
      {
        TableRow localTableRow = (TableRow)localView1;
        int m = 0;
        for (int n = 0; n < localTableRow.getChildCount(); n++)
        {
          View localView2 = localTableRow.getChildAt(n);
          TableRow.LayoutParams localLayoutParams = (TableRow.LayoutParams)localView2.getLayoutParams();
          m += localLayoutParams.leftMargin + localView2.getMeasuredWidth() + localLayoutParams.rightMargin;
        }
        if (m - localTableRow.getMeasuredWidth() > i) {
          i = m - localTableRow.getMeasuredWidth();
        }
      }
    }
    if (i > 0)
    {
      for (int k = 0; k < this.mBars.size(); k++) {
        ((HistogramBar)this.mBars.get(k)).setMaxBarWidth(this.mMaxBarWidth - i);
      }
      this.mBars.clear();
    }
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:34,代码来源:HistogramTable.java


示例4: createTextView

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
private TextView createTextView(boolean endline, boolean endcolumn){
    TextView text = new TextView(this, null, R.style.frag2HeaderCol);
    int bottom = endline ? 1 : 0;
    int right = endcolumn ? 1 :0;
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 0.3f);
    params.setMargins(1, 1, right, bottom);
    text.setLayoutParams(params);
    text.setPadding(4, 4, 10, 4);
    text.setBackgroundColor(getResources().getColor(R.color.white));
    return text;
}
 
开发者ID:IsticGLA,项目名称:SIT,代码行数:12,代码来源:TableActivity.java


示例5: createTextView

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
private TextView createTextView(boolean endline, boolean endcolumn){
    TextView text = new TextView(getActivity(), null, R.style.frag2HeaderCol);
    int bottom = endline ? 1 : 0;
    int right = endcolumn ? 1 :0;
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT, 0.3f);
    params.setMargins(1, 1, right, bottom);
    text.setLayoutParams(params);
    text.setPadding(4, 4, 10, 4);
    text.setBackgroundColor(getResources().getColor(R.color.white));
    return text;
}
 
开发者ID:IsticGLA,项目名称:SIT,代码行数:12,代码来源:TableFragment.java


示例6: onCreateView

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle bundle) {
    View rootView = inflater.inflate(R.layout.fragment_details, container,
            false);

    // Fill the table layout with rows for the fields depending on the item
    TableLayout table = (TableLayout)rootView.findViewById(R.id.TableLayout);

    for (int i = 0; i < mLabelIds.size(); i++) {
        // Don't switch to an inflated XML file for each row: way too slow
        TableRow row = new TableRow(getActivity());
        row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
                                             LayoutParams.WRAP_CONTENT));
        row.setPadding(0, 3, 0, 3);

        TextView titleView = new TextView(getActivity());
        titleView.setText(mLabelIds.get(i));
        titleView.setPadding(0, 0, 12, 0);
        titleView.setGravity(Gravity.TOP);
        titleView.setTypeface(Typeface.DEFAULT_BOLD);
        row.addView(titleView);

        TextView valueView = new TextView(getActivity());
        valueView.setText(mValues.get(i));
        titleView.setGravity(Gravity.TOP);
        row.addView(valueView);

        table.addView(row, new TableLayout.LayoutParams(
                                LayoutParams.MATCH_PARENT,
                                LayoutParams.WRAP_CONTENT));
    }

    return rootView;
}
 
开发者ID:cbosdo,项目名称:AquaBase,代码行数:36,代码来源:DetailsFragment.java


示例7: onCreate

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {

	super.onCreate(savedInstanceState);

	setContentView(R.layout.layout_scroll);

	TableLayout tableLayout=(TableLayout) findViewById(R.id.table_layout);
	TableRow row= new TableRow(this);
	TableRow.LayoutParams rowLayoutParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);
	row.setLayoutParams(rowLayoutParams);
	TableRow row2= new TableRow(this);
	TextView tv1 = new TextView(this);
	tv1.setSingleLine(false);
	tv1.setEllipsize(null);
	tv1.setTextSize(getResources().getDimension(R.dimen.textsize));
	tv1.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f));
	tv1.setHorizontallyScrolling(false);
	tv1.setText("THIS LINE OF THEXT SHOULD BE SINGFLE. DOUBLE MAYBE?");
	
	TextView tv2 = new TextView(this);
	tv2.setSingleLine(false);
	tv2.setEllipsize(null);
	tv2.setTextSize(getResources().getDimension(R.dimen.textsize));
	tv2.setLayoutParams(new TableRow.LayoutParams(0, LayoutParams.WRAP_CONTENT, 1f));
	tv2.setHorizontallyScrolling(false);
	tv2.setText("THIS LEINBE HAS to be multiline also?");
	
	row.addView(tv1);
	row2.addView(tv2);
	tableLayout.addView(row,2);
	tableLayout.addView(row2,3);

}
 
开发者ID:joaogithub,项目名称:Testes,代码行数:35,代码来源:TableLayoutActivity.java


示例8: addNextPreviousItemsButton

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
/**
 * buttons for view next items
 * @param next
 */
private void addNextPreviousItemsButton(boolean next)
{
    Button button = new Button(mMainActivity);
    
    int[] range;
    if(next)
    {
        button.setOnClickListener(nextItemsHandler);
        range = getNextRange();
    }
    else
    {
        button.setOnClickListener(previousItemsHandler);
        range = getPreviousRange();
    }
    
    button.setText(String.format("%d-%d", range[0]+1, range[1]+1));
    
    TableRow.LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, ConvertUnits.dp2px(HEIGHT_BUTTON_DP));
    params.span = mLayer.getAttributeHeader().getCountColumns();
    button.setLayoutParams(params);
    
    TableRow row = new TableRow(mMainActivity);
    row.addView(button);
    mTable.addView(row);
}
 
开发者ID:Jules-,项目名称:terraingis,代码行数:31,代码来源:AttributesFragment.java


示例9: loadHofTable

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
public void loadHofTable(){

  	TableLayout tl = (TableLayout)findViewById(R.id.hoftable);       
     
String filecontent = getStringFromFile("halloffame");        
     
      if (filecontent != "") {
      	
       String scores[] = filecontent.split(";");
   	
       for (int i=0; i<scores.length; i++){
           
       	String score[];
       	score = scores[i].split(",");
       	
       	TableRow tr = new TableRow(this);
           tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
	
           TextView points = new TextView(this);
           points.setGravity(Gravity.CENTER_VERTICAL);
           points.setGravity(Gravity.CENTER_HORIZONTAL);
           points.setTextColor(Color.BLACK);
           points.setText(score[0]);
           points.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
           tr.addView(points);
          
           TextView playername = new TextView(this);
           playername.setGravity(Gravity.CENTER_VERTICAL);
           playername.setGravity(Gravity.CENTER_HORIZONTAL);
           playername.setTextColor(Color.BLACK);
           playername.setText(score[1]);
           playername.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
           tr.addView(playername);
           
           TextView dat = new TextView(this);
           dat.setGravity(Gravity.CENTER_VERTICAL);
           dat.setGravity(Gravity.CENTER_HORIZONTAL);
           dat.setTextColor(Color.BLACK);
           dat.setText(score[2]);
           dat.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
           tr.addView(dat);
           
           tl.addView(tr,new TableLayout.LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));		
       }
      }  
  }
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:47,代码来源:Hof.java


示例10: BuildTable

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
private void BuildTable() {

  sqlcon.open();
  Cursor c = sqlcon.readEntry();

  int rows = c.getCount();
  int cols = c.getColumnCount();

  c.moveToFirst();

  // outer for loop
  for (int i = 0; i < rows; i++) {

   TableRow row = new TableRow(this);
   row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT,
     LayoutParams.WRAP_CONTENT));

   // inner for loop
   for (int j = 0; j < cols; j++) {

    TextView tv = new TextView(this);
    tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
      LayoutParams.WRAP_CONTENT));
 //   tv.setBackgroundResource(R.drawable.cell_shape);
    tv.setGravity(Gravity.CENTER);
    tv.setTextSize(18);
    tv.setPadding(0, 5, 0, 5);

    tv.setText(c.getString(j));

    row.addView(tv);

   }

   c.moveToNext();

   table_layout.addView(row);

  }
/*  int tLastStep = 0;
  String tgl = "";
  Cursor tCursor = sqlcon.getLast();
  if (tCursor != null) {
		tLastStep = tCursor.getInt(0);
		tgl = tCursor.getString(4);
		tCursor.close();
	}
  
  Toast.makeText(ShowLocalStep.this,
			"Last step : "+Integer.toString(tLastStep)+" - "+tgl, Toast.LENGTH_LONG)
			.show();
			*/
  sqlcon.close();
 
 }
 
开发者ID:lskk,项目名称:Steppy-Android,代码行数:56,代码来源:ShowLocalStep.java


示例11: onViewCreated

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
	super.onViewCreated(view, savedInstanceState);
	
	setTitleText(R.string.login_bt);
	
	Context context = getActivity();
	
	//注册按钮
	Button registerBtn = new Button(context);
	registerBtn.setId(ID_REGISTER_BTN);
	registerBtn.setText(R.string.register_btn);
	registerBtn.setTextSize(17);
	registerBtn.setTextColor(Color.WHITE);
	registerBtn.setBackgroundResource(R.drawable.button_focused);
	registerBtn.setOnClickListener(this);

	RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
			UIUtil.dip2px(context, 60), LayoutParams.MATCH_PARENT);
	lp2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	lp2.addRule(RelativeLayout.CENTER_VERTICAL);
	addViewInTitleBar(registerBtn, lp2);
	
	//登录按钮
	Button loginBtn = (Button) view.findViewById(R.id.login_bt);
	loginBtn.setOnClickListener(this);
	loginBtn.setBackgroundDrawable(StateList.get());
			
	view.findViewById(R.id.qq_login_btn).setOnClickListener(this);
	view.findViewById(R.id.wechat_login_btn).setOnClickListener(this);
	view.findViewById(R.id.sina_weibo_login_btn).setOnClickListener(this);
	
	userNameEdit = (EditText) view.findViewById(R.id.username);
	passwordEdit = (EditText) view.findViewById(R.id.userpass);
	
	// 获取用户信息
	UserInfo userInfo = UserManager.getInstance().getUserInfo();
	if (userInfo != null) {
		userNameEdit.setText(userInfo.getUserName());
		passwordEdit.setText(userInfo.getPassword());
	}
	
	view.findViewById(R.id.forget_password_text).setOnClickListener(this);
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:45,代码来源:LoginFragment.java


示例12: onViewCreated

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
	super.onViewCreated(view, savedInstanceState);

	setTitleText(R.string.individualCenterFragment_title);
	
	nickNameText = (TextView) view.findViewById(R.id.individual_nickname_tv);
	levelText = (TextView) view.findViewById(R.id.individual_level_tv);
	locationText = (TextView) view.findViewById(R.id.individual_location_tv);
	view.findViewById(R.id.individual_message).setOnClickListener(this);

	imageView = (ImageView) view.findViewById(R.id.avatar_image);
	imageView.setOnClickListener(this);

	Context context = getActivity();

	// 注销按钮
	logoutBtn = new ImageButton(context);
	logoutBtn.setId(ID_LOGOUT_BTN);
	logoutBtn.setImageResource(R.drawable.ic_logout);
	logoutBtn.setBackgroundResource(R.drawable.button_focused);
	logoutBtn.setOnClickListener(this);

	RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(
			UIUtil.dip2px(context, 40), LayoutParams.MATCH_PARENT);
	lp2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	lp2.addRule(RelativeLayout.CENTER_VERTICAL);
	addViewInTitleBar(logoutBtn, lp2);

	listview = (RoundListView) view
			.findViewById(R.id.individual_center_listview);
	listview.setOnItemClickListener(this);
	
	items = new ArrayList<SettingItem>();
	items.add(new SettingItem(POSITION_RANK, context.getResources()
			.getDrawable(R.drawable.ic_rank_black), getResources().getString(R.string.myIntegralFragment_title)));
	items.add(new SettingItem(POSITION_BALANCE, context.getResources()
			.getDrawable(R.drawable.ic_balance_black), getResources().getString(R.string.aboutus)));
	items.add(new SettingItem(POSITION_TASK, context.getResources()
			.getDrawable(R.drawable.ic_task_black), getResources().getString(R.string.myTaskFragment_title)));

	items.add(new SettingItem(POSITION_TASK, context.getResources()
			.getDrawable(R.drawable.ic_message), getResources().getString(R.string.myMessageFragment_title)));

	mAdapter = new SettingAdapter(items);
	listview.setAdapter(mAdapter);

	// 先读取缓存的数据,然后再更新
	UserInfo userInfo = UserManager.getInstance().getUserInfo();
	DebugLog.i(TAG, "Cached UserInfo = " + userInfo);

	attachUserInfo2View(userInfo);
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:54,代码来源:IndividualCenterFragment.java


示例13: ConfirmWithCloseButtonDialog

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
public ConfirmWithCloseButtonDialog(final Activity activity) {
	super(activity);
	
	RelativeLayout parentLayout = new RelativeLayout(activity);
	parentLayout.setBackgroundColor(Color.TRANSPARENT);
	
	setContentView(parentLayout, lpmw);
	
	float r = 10;
	float[] outerR = new float[] { r, r, r, r, r, r, r, r };
	RoundRectShape rr = new RoundRectShape(outerR, null, null);
	ShapeDrawable drawable = new ShapeDrawable(rr);
	drawable.getPaint().setColor(Color.WHITE);
	
	layout = new LinearLayout(activity);
	layout.setOrientation(LinearLayout.VERTICAL);
	layout.setGravity(Gravity.CENTER);
	layout.setBackgroundDrawable(drawable);
	
	RelativeLayout.LayoutParams lp1 = new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
	lp1.topMargin = UIUtil.dip2px(activity, 10);
	lp1.rightMargin = UIUtil.dip2px(activity, 10);
	parentLayout.addView(layout, lp1);
	
	//关闭按钮
	ImageButton closeBtn = new ImageButton(activity);
	closeBtn.setBackgroundResource(R.drawable.emotionstore_progresscancelbtn);
	closeBtn.setOnClickListener(new View.OnClickListener() {
		
		@Override
		public void onClick(View v) {
			dismiss();
		}
	});
	
	RelativeLayout.LayoutParams lp2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	lp2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
	parentLayout.addView(closeBtn, lp2);
	
	setDim(0.5f);
	
	// 设置为屏幕宽度
	setWindowWidth(Environment.getInstance().getScreenWidth());
}
 
开发者ID:leleliu008,项目名称:Newton_for_Android_AS,代码行数:45,代码来源:ConfirmWithCloseButtonDialog.java


示例14: onCreate

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    
    target = R.id.matrix_button;

    int currentIndex;
    TableRow tableRow;
    // Define the layout. 
    setContentView(R.layout.matrix_display_view);

    // Parse the values from the parent 
    Intent intent = getIntent();
    this.height = intent.getIntExtra(MatrixInputActivity.MATRIX_SIZE,5);
    this.matrix = new float[this.height][];
    for(int i=0;i<this.height;i++){
        this.matrix[i] = intent.getFloatArrayExtra(
                MatrixInputActivity.MATRIX_VALUES+i);
    }
    this.results = intent.getFloatArrayExtra(
            MatrixInputActivity.MATRIX_RESULTS);
    // the we are always a linear equation 
    this.width = this.height + 1;

    // initialize the array
    this.textViewArray = new TextView[this.width*this.height];

    // get the table view to draw in it
    matrixTable = (TableLayout)findViewById(R.id.matrix_display_table);

    // traverse rows
    for(int i=0;i<this.height;i++){
        //traverse each element of the row
        tableRow = new TableRow(this);
        for(int j=0;j<this.width;j++){
            currentIndex = i*this.width + j; // this points to the location of t                                                                      // editText in the matrix
            this.textViewArray[currentIndex] = new TextView(this);
            this.textViewArray[currentIndex].setLayoutParams(
                    new LayoutParams(
                        LayoutParams.FILL_PARENT,
                        LayoutParams.WRAP_CONTENT)
                    );
            this.textViewArray[currentIndex].setPadding(5, 5, 5, 5);
            if(j==this.width-1){
                this.textViewArray[currentIndex].setText(" " + this.results[i]);
            }else{
                this.textViewArray[currentIndex].setText(" " + this.matrix[i][j]);
            }
            tableRow.addView(this.textViewArray[currentIndex]);
        }
        textViewArray[0].measure(MeasureSpec.UNSPECIFIED,
                    MeasureSpec.UNSPECIFIED);
        // this will add target and position-specific views to hint the
        // user of what we are doing
        tableRow = decorateTableRow(tableRow, 
                    textViewArray[0].getMeasuredHeight(),
                    textViewArray[0].getMeasuredWidth(),
                    i);


        matrixTable.addView(tableRow, new TableLayout.LayoutParams(
                    LayoutParams.FILL_PARENT,
                    LayoutParams.WRAP_CONTENT));

    }

}
 
开发者ID:GIDAIbero,项目名称:MATSOL-Android,代码行数:68,代码来源:MatrixDisplayActivity.java


示例15: decorateTableRow

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
private TableRow decorateTableRow(TableRow tableRow, int height,
        int width, int row){
    ImageView leftImageView = new ImageView(this);
    ImageView rightImageView = new ImageView(this); 
    leftImageView.setBackgroundResource(R.drawable.left_edge);
    rightImageView.setBackgroundResource(R.drawable.right_edge);
    if(target==R.id.matrix_button){
        // we need to allocate two more elements
        ImageView insideLeftImageView = new ImageView(this);
        ImageView insideRightImageView = new ImageView(this);
        if(row==0){ // should change decorators for top decorators
            leftImageView.setBackgroundResource(
                    R.drawable.top_left_edge);
            rightImageView.setBackgroundResource(
                    R.drawable.top_right_edge);
            insideLeftImageView.setBackgroundResource(
                    R.drawable.top_right_edge); // this is not a mistake
            insideRightImageView.setBackgroundResource(
                    R.drawable.top_left_edge);
        }else if(row == this.height-1){
            leftImageView.setBackgroundResource(
                    R.drawable.bottom_left_edge);
            rightImageView.setBackgroundResource(
                    R.drawable.bottom_right_edge);
            insideLeftImageView.setBackgroundResource(
                    R.drawable.bottom_right_edge); // this is not a mistake
            insideRightImageView.setBackgroundResource(
                    R.drawable.bottom_left_edge);

        }else{
            insideRightImageView.setBackgroundResource(
                    R.drawable.left_edge);
            insideLeftImageView.setBackgroundResource(
                    R.drawable.right_edge);
        }
        insideLeftImageView.setLayoutParams(new LayoutParams(
                    height,width/5));
        insideRightImageView.setLayoutParams(new LayoutParams(
                    height,width/5));
        insideRightImageView.getLayoutParams().height = height;
        insideLeftImageView.getLayoutParams().height = height;
        insideRightImageView.getLayoutParams().width = width/5;
        insideLeftImageView.getLayoutParams().width = width/5;
        tableRow.addView(insideLeftImageView,this.width-1);
        tableRow.addView(insideRightImageView,this.width);

    }else{
        // this is a determinant button
    }
    leftImageView.setLayoutParams(new LayoutParams(
                height,width/10));
    rightImageView.setLayoutParams(new LayoutParams(
                height,width/10));
    leftImageView.getLayoutParams().height = height;
    rightImageView.getLayoutParams().height = height;
    leftImageView.getLayoutParams().width = width/5;
    rightImageView.getLayoutParams().width = width/5;
    tableRow.addView(leftImageView,0);
    tableRow.addView(rightImageView);
    return tableRow;
}
 
开发者ID:GIDAIbero,项目名称:MATSOL-Android,代码行数:62,代码来源:MatrixDisplayActivity.java


示例16: onPreferenceClick

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
@Override
public boolean onPreferenceClick(Preference p1)
{
	// TODO: Implement this method
	Intent mIntent = new Intent();
	switch (p1.getKey())
	{
		case "key_contact":
			mIntent.setAction(Intent.ACTION_VIEW)
				.setData(Uri.parse("mailto:[email protected]"))
				.putExtra(Intent.EXTRA_SUBJECT, "Flashlight Fixer [board name = " + Cmd.SH.ex("getprop ro.product.board").getString() + "]")
				.putExtra(Intent.EXTRA_TEXT, "Flashlight sysfs path = " + Cmd.SH.ex("busybox find /sys -group camera 2> /dev/null").getString() + "\n\n");
			try
			{startActivity(mIntent);}
			catch (Exception e)
			{
				EditText mEt = new EditText(this);
				mEt.setLayoutParams(new ViewGroup.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
				mEt.setText(
					"Board name = " + Cmd.SH.ex("getprop ro.product.board").getString() +
					"\nFlashlight sysfs path = " + Cmd.SH.ex("busybox find /sys -group camera 2> /dev/null").getString()
				);
				new AlertDialog.Builder(this)
					.setTitle("May I have some data")
					.setView(mEt)
					.show();
			}
			break;

		case "key_uituner":
			mIntent.setAction(Intent.ACTION_VIEW)
				.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.bassel.uituner"));
			startActivity(mIntent);
			break;

		case "key_donate":
			mIntent.setAction(Intent.ACTION_VIEW)
				.setData(Uri.parse("https://play.google.com/store/apps/details?id=com.bassel.uituner.donation"));
			startActivity(mIntent);
			break;
	}
	return true;
}
 
开发者ID:Bassel-Bakr,项目名称:Xposed_Flashlight_Fixer,代码行数:44,代码来源:MainActivity.java


示例17: addColumnToRow

import android.widget.TableRow.LayoutParams; //导入依赖的package包/类
/**
	 * adds one column to the given row 
	 * @param row
	 */
	protected void addColumnToRow(final TableRow row){
		int columnIndex = row.getChildCount();
        int rowIndex = table.indexOfChild(row);
        if(rowIndex == -1){
        	rowIndex = headerTable.indexOfChild(row);
        	if(rowIndex == -1)         Log.d("critical", "cant find row!");
        }
        View newElement = null;
        //get the needed content_type by choosing it to be the first rows type
        View firstRowView = null;
        TableRow firstRow = (TableRow) table.getChildAt(0);
        if(firstRow != null){
        	firstRowView = firstRow.getChildAt(columnIndex);
        }
        if(firstRowView instanceof EditText){
        	newElement = initTextField(row, jacksonTable.getEntry(columnIndex, rowIndex));
        }
        else if(firstRowView instanceof LinearLayout){
        	if(((LinearLayout) firstRowView).getChildAt(0) instanceof CheckBox){
        		newElement = initCheckBox(row, jacksonTable.getEntry(columnIndex, rowIndex));
        	}
        	else{// if(((LinearLayout) firstRowView).getChildAt(0) instanceof TextView){
            	newElement = initPopup(row, jacksonTable.getEntry(columnIndex, rowIndex), columnIndex, rowIndex);
            }
        }
        else{
        	//firstRowView should be null now -> its a new column
        	// could also be the first row inserted after an empty table
        	// quick temp fix
        	if(row == headerTable.getChildAt(0)) {
//        		Log.d("row==headerTable", "col:"+columnIndex+ " row:"+rowIndex);
        		newElement = initTextField(row, jacksonTable.getColumnHeader(columnIndex), false);
        		Log.d("TableFragment", "setting onclicklistener");
        		newElement.setOnClickListener(new OnClickListener() {
        			@Override
        			public void onClick(View arg0) {
        				showDialog();
        			}
        		});
        	}
        	else {
//        		Log.d("row==ChildTable", "col:"+columnIndex+ " row:"+rowIndex);
        		newElement = initTextField(row, jacksonTable.getEntry(columnIndex, rowIndex), true);
        	}
        }
		row.addView(newElement);
		int width = getNeededWidth(columnIndex);
		int height = getNeededHeight(rowIndex, row);
//		int oldWidth = oneColumn.getMeasuredWidth();
//		int oldHeight = oneColumn.getMeasuredWidth();
		final LayoutParams lparams = new LayoutParams(width, height);
	    newElement.setLayoutParams(lparams);
	    // moved to initEditText
//        if (headerTable.indexOfChild(row) != -1) {
			//setHeaderTableStyle((EditText) newElement);
//			if(((EditText)newElement).getText().toString().isEmpty()) {
//				((EditText) newElement)
//						.setText(getResources().getString(R.string.headline)
//								+ " "
//								+ (((TableRow) headerTable.getChildAt(0))
//										.getChildCount()));
//			}
//		} else {
//			setTableStyle(newElement);
//		}

	}
 
开发者ID:FAU-Inf2,项目名称:rpgpack-android,代码行数:72,代码来源:TableFragment.java



注:本文中的android.widget.TableRow.LayoutParams类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InputType类代码示例发布时间:2022-05-21
下一篇:
Java JobCounter类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap