Java 类android.widget.TableLayout.LayoutParams 实例源码

项目:SkyRover_Android    文件:CustomSeekBar.java   
public CustomSeekBar(Context context, AttributeSet attrs)
{
    super (context, attrs);

    setThumbOffset(2);

    lowerBoundView = new TextView(context, attrs);
    lowerBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    lowerBoundView.setGravity(Gravity.LEFT);

    upperBoundView = new TextView(context, attrs);
    upperBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    upperBoundView.setGravity(Gravity.RIGHT);

    initControl(context, attrs);

    updateTextColor();
}
项目:SkyRover_Android    文件:CustomSeekBar.java   
public CustomSeekBar(Context context, AttributeSet attrs, int defStyle)
{
    super(context, attrs, defStyle);

    setThumbOffset(2);

    lowerBoundView = new TextView(context, attrs, defStyle);
    lowerBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    lowerBoundView.setGravity(Gravity.LEFT);

    upperBoundView = new TextView(context, attrs, defStyle);
    upperBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    upperBoundView.setGravity(Gravity.RIGHT);

    initControl(context, attrs);

    updateTextColor();
}
项目:persontracker    文件:ParrotSeekBar.java   
public ParrotSeekBar(Context context, AttributeSet attrs)
{
    super (context, attrs);

    setThumbOffset(2);

    lowerBoundView = new TextView(context, attrs);
    lowerBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    lowerBoundView.setGravity(Gravity.LEFT);

    upperBoundView = new TextView(context, attrs);
    upperBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    upperBoundView.setGravity(Gravity.RIGHT);

    initControl(context, attrs);

    updateTextColor();
}
项目:persontracker    文件:ParrotSeekBar.java   
public ParrotSeekBar(Context context, AttributeSet attrs, int defStyle) 
{
    super(context, attrs, defStyle);

    setThumbOffset(2);

    lowerBoundView = new TextView(context, attrs, defStyle);
    lowerBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    lowerBoundView.setGravity(Gravity.LEFT);

    upperBoundView = new TextView(context, attrs, defStyle);
    upperBoundView.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT));
    upperBoundView.setGravity(Gravity.RIGHT);

    initControl(context, attrs);

    updateTextColor();
}
项目:JVC-Forums-Reader    文件:KickInterfaceActivity.java   
@Override
public void onShowReasonClick(Entry entry)
{
    PostItem item = new PostItem(KickInterfaceActivity.this, true, showNoelshackThumbnails, animateSmileys);
    JvcPost post = new JvcPost(null, 0, entry.getMessage() + "\n", entry.getPseudo(), false, false, 1, "", null, null);
    item.updateDataFromPost(post, false);

    final int tenDp = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics());
    LinearLayout layout = new LinearLayout(KickInterfaceActivity.this);
    layout.setOrientation(LinearLayout.VERTICAL);
    layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    layout.setBackgroundColor(Color.WHITE);

    TextView tv = new TextView(KickInterfaceActivity.this);
    LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    params.bottomMargin = params.topMargin = tenDp;
    tv.setLayoutParams(params);
    tv.setTextSize(16);
    tv.setGravity(Gravity.CENTER);
    tv.setTextColor(getResources().getColor(R.color.jvcTopicName));
    tv.setTypeface(null, Typeface.BOLD);
    tv.setText("\u00AB " + entry.getSubject() + " \u00BB");
    layout.addView(tv);
    layout.addView(item.getView());

    Dialog previewDialog = new Dialog(KickInterfaceActivity.this, R.style.FullScreenNoTitleDialogTheme);
    previewDialog.setContentView(layout);
    previewDialog.setCancelable(true);
    previewDialog.show();
}
项目:JVC-Forums-Reader    文件:ForumActivity.java   
public void forumReplyFormPreviewButtonClick(View view)
{
    if(topicSubjectEdit.length() > 0)
    {
        if(topicContentEdit.length() > 0)
        {
            MainApplication appContext = (MainApplication) getApplicationContext();
            PostItem item = new PostItem(this, true, showNoelshackThumbnails, animateSmileys);
            String date = new SimpleDateFormat("d MMMM y \u00E0 HH:mm:ss", Locale.FRANCE).format(new Date());
            JvcPost post = new JvcPost(null, 0, getPostTextWithSignature() + "\n", appContext.getJvcPseudo(), false, topicPostAsMobileCheckBox.isChecked(), 1, date, null, null);
            item.updateDataFromPost(post, true);

            final int tenDp = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics());
            LinearLayout layout = new LinearLayout(this);
            layout.setOrientation(LinearLayout.VERTICAL);
            layout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
            layout.setBackgroundColor(Color.WHITE);

            TextView tv = new TextView(this);
            LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
            params.bottomMargin = params.topMargin = tenDp;
            tv.setLayoutParams(params);
            tv.setTextSize(16);
            tv.setGravity(Gravity.CENTER);
            tv.setTextColor(getResources().getColor(R.color.jvcTopicName));
            tv.setTypeface(null, Typeface.BOLD);
            String title = "\u00AB " + topicSubjectEdit.getText().toString() + " \u00BB\nPage 1 / 1";
            if(enableSmileys)
                tv.setText(JvcTextSpanner.getSpannableTextFromSmileyNames(title, JvcUserData.getBoolean(JvcUserData.PREF_ANIMATE_SMILEYS, JvcUserData.DEFAULT_ANIMATE_SMILEYS)));
            else
                tv.setText(title);
            layout.addView(tv);

            layout.addView(item.getView());

            Dialog previewDialog = new Dialog(this, R.style.FullScreenNoTitleDialogTheme);
            previewDialog.setContentView(layout);
            previewDialog.setCancelable(true);
            previewDialog.setOnDismissListener(new OnDismissListener()
            {
                @Override
                public void onDismiss(DialogInterface dialog)
                {
                    setAnimationView(scrollView);
                }
            });
            previewDialog.show();
            setAnimationView(layout);
        }
        else
        {
            Toast.makeText(this, R.string.postEmpty, Toast.LENGTH_LONG).show();
        }
    }
    else
    {
        Toast.makeText(this, R.string.subjectEmpty, Toast.LENGTH_LONG).show();
    }
}
项目:DigitalPassbook    文件:ListAccount.java   
@Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main3);
       db1=openOrCreateDatabase("bank.db", Context.MODE_PRIVATE, null);
       db1.execSQL("CREATE TABLE IF NOT EXISTS Account_Details (AccountNo INTEGER PRIMARY KEY, DateOfOpening DATE NOT NULL," +
            " Type TEXT CHECK((Type='CURRENT')OR(Type='SAVINGS')), BankName TEXT NOT NULL, BranchName TEXT NOT NULL, " +
            "BranchAddress TEXT NOT NULL, BranchPhno INTEGER, BranchFaxNo INTEGER, IFSCCode TEXT NOT NULL, ClearBalance INTEGER, " +
            "UnclearBalance INTEGER);");
       Cursor c=db1.rawQuery("SELECT * FROM Account_Details ORDER BY DateOfOpening DESC;",null);
       if(c!=null)
                {if(c.moveToFirst())

      do{

        String d4=c.getString(c.getColumnIndex("BankName"));
    final Long d1=c.getLong((c.getColumnIndex("AccountNo")));

        String temp=d1.toString();
        Button bt=new Button(ListAccount.this);
        ViewGroup tablelayout=(ViewGroup)findViewById(R.id.table3);
        bt.setText(temp);

        TextView tv=new TextView(ListAccount.this);
        tv.setText(d4);

        tv.setTextColor(Color.parseColor("#00CCFF"));
        tv.setGravity(Gravity.CENTER);
        bt.setBackgroundColor(Color.parseColor("#CCCCCC")); 
        bt.setPadding(0, 3, 0, 0);

        TableRow row;
        TableLayout.LayoutParams lp = new TableLayout.LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT);
        lp.setMargins(0, 10, 0, 0);

        row = new TableRow( this );
        tablelayout.addView( row );
        row.setLayoutParams(lp);
        int px=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,140,getResources().getDisplayMetrics());
        int px1=(int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 35,getResources().getDisplayMetrics());
        row.addView(tv,px,px1);
        row.addView(bt,px,px1);
        registerForContextMenu(bt);
        bt.setOnClickListener(new View.OnClickListener() {


            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
            Intent nextscreen=new Intent(getApplicationContext(),AccDetails.class);
            nextscreen.putExtra("id", d1);
            Log.e("List Screen",".");
               startActivity(nextscreen);       
            }
        });

j++;    }while(c.moveToNext());
      }
       if(j==0)
       { noDet=new TextView(ListAccount.this);
    ViewGroup linearlayout=(ViewGroup)findViewById(R.id.newbutton);
    noDet.setText("No Accounts to view");
    noDet.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
    noDet.setTextColor(Color.WHITE);
    noDet.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 24);
    linearlayout.addView(noDet);
 }
 }