Java 类android.widget.TableLayout 实例源码

项目:SensorTag2Testing    文件:BarometerProfile.java   
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    tr = new GenericTabRow(con);
    tr.sl1.autoScale = true;
    tr.sl1.autoScaleBounceBack = true;
    tr.sl1.setColor(255, 0, 150, 125);
    tr.sl1.maxVal = 100;
    tr.sl1.minVal = 0;
    tr.setIcon("sensortag2", "barometer");
    tr.title.setText("Barometer Data");
    tr.uuidLabel.setText(GattData);
    tr.value.setText("0.0mBar, 0.0m");
    tr.periodBar.setProgress(100);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
    super.registerNotificationImp(bytes -> {
        convertRaw(bytes);
        double h = ((baro/100.0)/PA_PER_METER - 70.0);
        tr.value.setText(String.format("%.1f mBar %.1f meter", baro/100.0, h));
        tr.sl1.addValue(baro);
        if (DBG)
            Log.d(TAG, "Baro:" + baro);
    });
    return false;
}
项目:SensorTag2Testing    文件:HumidityProfile.java   
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    tr = new GenericTabRow(con);
    tr.sl1.autoScale = true;
    tr.sl1.autoScaleBounceBack = true;
    tr.sl1.setColor(255, 0, 150, 125);
    tr.sl1.maxVal = 100;
    tr.sl1.minVal = 0;
    tr.setIcon("sensortag2", "humidity");
    tr.title.setText("Humidity Data");
    tr.uuidLabel.setText(GattData);
    tr.value.setText("0.0%rH");
    tr.periodBar.setProgress(100);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));
    super.registerNotificationImp(bytes -> {
        convertRaw(bytes);
        tr.value.setText(String.format("%.1f %%rH", humidity));
        tr.sl1.addValue(humidity);
        if (DBG)
            Log.d(TAG, "Humidity:" + humidity);
    });
    return false;
}
项目:SensorTag2Testing    文件:LuxometerProfile.java   
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    tr = new GenericTabRow(con);
    tr.sl1.autoScale = true;
    tr.sl1.autoScaleBounceBack = true;
    tr.sl1.setColor(255, 0, 150, 125);
    tr.setIcon("sensortag2", "lightsensor");
    tr.title.setText("Luxometer Data");
    tr.uuidLabel.setText(GattData);
    tr.value.setText("0.0 Lux");
    tr.periodBar.setProgress(100);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));

    super.registerNotificationImp(bytes -> {
        convertRaw(bytes);
        tr.value.setText(String.format("%.1f Lux", lux));
        tr.sl1.addValue(lux);
        if (DBG)
            Log.d(TAG, "Lux:" + lux);
    });
    return false;
}
项目:SensorTag2Testing    文件:SimpleKeyProfile.java   
@Override
public boolean registerNotification(Context con, View parenet, TableLayout tabLayout) {
    SimpleKeyTabRow tr = new SimpleKeyTabRow(con);
    tr.setId(parenet.generateViewId());
    tr.setIcon("sensortag2", "simplekeys");
    tr.title.setText("Key press state");
    tr.uuidLabel.setText(GattData);
    tr.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT));
    tabLayout.addView(tr, new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.WRAP_CONTENT));

    super.registerNotificationImp( bytes -> {
        convertRaw(bytes);

        tr.leftKeyPressState.setImageResource(isLeftKey() ? R.drawable.leftkeyon_300 : R.drawable.leftkeyoff_300);
        tr.rightKeyPressState.setImageResource(isRightKey() ? R.drawable.rightkeyon_300 : R.drawable.rightkeyoff_300);
        tr.reedState.setImageResource(isReed() ? R.drawable.reedrelayon_300 : R.drawable.reedrelayoff_300);
        tr.lastKeys = keyState;
        if (DBG)
            Log.d(TAG, "Left key:" + getKeyState(true) + ", " +
                    "Right key:" + getKeyState(false));
    });
    return true;
}
项目:planetcon    文件:TextAdapter.java   
public void showInfoGame(TableLayout table) {
    table.removeAllViews();
    if (mStateInfoGame == INFO_STATS) {
        TextView textView;
        mNumCols = measureNumColumns(table, getItem(0), mInfoBuilder.getItemStatsHeader());
        mNumCols = Math.max(2, mNumCols);
        mNumCols = Math.min(mNumCols, getSize() + 1);
        mNumRows = (int)Math.ceil( (double)getSize() / (mNumCols - 1) );
        TableRow row = new TableRow(mContext);
        table.addView(row, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
        for (int c = 0; c < mNumCols; c++) {
            textView = createTextView(getColumn(c-1));
            if (c > 0) textView.setGravity(Gravity.CENTER);
            row.addView(textView, TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT);
        }
    }
}
项目:editor-sql    文件:SqlCreateViewAdapter.java   
public MyHolder(View itemView) {
    super(itemView);
    tableLayout = (TableLayout) itemView.findViewById(R.id.sql_tabview_item);
    tableRow = new TableRow(mContext);
    tableRow.setMinimumWidth(FeViewUtils.dpToPx(100));
    tableLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if(mIsInformation){
                mClickPosition = -1;
            }else {
                mClickPosition = (int) tableLayout.getTag();
            }
            Bundle bundle = new Bundle();
            bundle.putInt(ViewEvent.Keys.SQL_TAB_ITEM_CLICK, mClickPosition);
            EventBus.getDefault().post(new ViewEvent(ViewEvent.EvenType.sqlTabItemClick, bundle));
            notifyDataSetChanged();
        }
    });
}
项目:editor-sql    文件:TabDatasAdapter.java   
public MyHolder(View itemView) {
    super(itemView);
    tableLayout = (TableLayout) itemView.findViewById(R.id.sql_tabview_item);
    tableRow = new SqlViewTabRow(mContext, mWidthList,scale,heightList);
    tableLayout.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Bundle bundle = new Bundle();
            mClickPosition = (int) tableLayout.getTag();
            bundle.putInt(ViewEvent.Keys.SQL_TAB_ITEM_CLICK, mClickPosition);
            if(dataSource == SqlConstant.TABLE_DATAS_NORMAL){
                EventBus.getDefault().post(new ViewEvent(ViewEvent.EvenType.sqlTabDataItemClick, bundle));
            }else if(dataSource == SqlConstant.TABLE_DATAS_FILTER){
                EventBus.getDefault().post(new ViewEvent(ViewEvent.EvenType.sqlTabDataFilterItemClick, bundle));
            }
        }
    });
}
项目:editor-sql    文件:SqlTabDatasActivity.java   
private void initView() {
    mTabHeader = (TableLayout) findViewById(R.id.sql_tabview_header_tab);
    mRecycleView = (FastScrollRecyclerView) findViewById(R.id.sql_tabview_recycleview);
    mLinearLayoutManager = new LinearLayoutManager(SqlTabDatasActivity.this);
    mLinearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    mRecycleView.setLayoutManager(mLinearLayoutManager);
    mContent = (MyHorizontalScrollView) findViewById(R.id.content);
    mRecycleView.setMinimumWidth(FeViewUtils.getScreenWidth(this));
    mToolBar = (Toolbar) findViewById(R.id.toolbar);
    mAdmobLayout = (RelativeLayout) findViewById(R.id.admob_layout);
    mRootLayout = (RelativeLayout) findViewById(R.id.rootLayout);
    mAdView = (AdView) findViewById(R.id.adView);
    mAdMobBgBtn = (Button) findViewById(R.id.admob_bg_btn);
    mAdClose = (ImageView) findViewById(R.id.admob_close);
    btn = (FloatingActionButton) findViewById(R.id.fab);
    mTabHeader.setBackground(getResources().getDrawable(R.color.table_head_bg));

    if (dataSource != SqlConstant.TABLE_DATAS_NORMAL) {
        btn.setVisibility(View.GONE);
    } else {
        btn.setVisibility(View.VISIBLE);
    }

    resultHandler = new SqlActivityResultHandler(this);
}
项目:AndroidSnooper    文件:EspressoViewMatchers.java   
public static Matcher<View> withTableLayout(final int tableLayoutId, final int row, final int column) {
  return new CustomTypeSafeMatcher<View>(format("Table layout with id: {0} at row: {1} and column: {2}",
    tableLayoutId, row, column)) {
    @Override
    protected boolean matchesSafely(View item) {
      View view = item.getRootView().findViewById(tableLayoutId);

      if (view == null || !(view instanceof TableLayout))
        return false;
      TableLayout tableLayout = (TableLayout) view;
      TableRow tableRow = (TableRow) tableLayout.getChildAt(row);
      View childView = tableRow.getChildAt(column);
      return childView == item;
    }
  };
}
项目:underlx    文件:HomeStatsFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_home_stats, container, false);

    Context context = view.getContext();

    lineStatsLayout = (TableLayout) view.findViewById(R.id.line_stats_layout);
    progressBar = (ProgressBar) view.findViewById(R.id.loading_indicator);
    lastDisturbanceView = (HtmlTextView) view.findViewById(R.id.last_disturbance_view);
    progressBar.setVisibility(View.VISIBLE);
    updateInformationView = (TextView) view.findViewById(R.id.update_information);

    IntentFilter filter = new IntentFilter();
    filter.addAction(MainActivity.ACTION_MAIN_SERVICE_BOUND);
    filter.addAction(MainService.ACTION_UPDATE_TOPOLOGY_FINISHED);
    filter.addAction(StatsCache.ACTION_STATS_UPDATE_STARTED);
    filter.addAction(StatsCache.ACTION_STATS_UPDATE_SUCCESS);
    filter.addAction(StatsCache.ACTION_STATS_UPDATE_FAILED);
    LocalBroadcastManager bm = LocalBroadcastManager.getInstance(context);
    bm.registerReceiver(mBroadcastReceiver, filter);
    redraw(context);
    return view;
}
项目:TitleBarView    文件:ViewUtil.java   
/**
 * 设置View的Margin
 *
 * @param view
 * @param left
 * @param top
 * @param right
 * @param bottom
 * @param width
 * @param height
 */
public void setViewMargin(View view, int left, int top, int right, int bottom, int width, int height) {
    if (view == null) {
        return;
    }
    ViewParent parent = view.getParent();
    if (parent == null) {
        return;
    }
    ViewGroup.MarginLayoutParams lp;
    if (parent instanceof LinearLayout) {
        lp = new LinearLayout.LayoutParams(width, height);
    } else if (parent instanceof RelativeLayout) {
        lp = new RelativeLayout.LayoutParams(width, height);
    } else if (parent instanceof FrameLayout) {
        lp = new FrameLayout.LayoutParams(width, height);
    } else {
        lp = new TableLayout.LayoutParams(width, height);
    }
    if (lp != null) {
        lp.setMargins(left, top, right, bottom);
        view.setLayoutParams(lp);
    }
}
项目:TitanCompanion    文件:STRIDERAdventureTimeOxygenFragment.java   
private void paintBar(TableLayout table, Integer time) {
    for(int i = 0 ; i < table.getChildCount(); i++) {
        View view = table.getChildAt(i);
        if (view instanceof TableRow) {

            TableRow row = (TableRow) view;
            View cell = ((TableRow) view).getChildAt(0);


            if(i<time){
                if(((double)time/(double)table.getChildCount())<0.85d){
                    cell.setBackgroundColor(Color.parseColor("#4fa5d5"));
                }else{
                    cell.setBackgroundColor(Color.parseColor("#ed1c00"));
                }
            }else{
                cell.setBackgroundColor(0x00000000);
            }
        }
    }
}
项目:UIWidget    文件:ViewUtil.java   
/**
 * 设置View的Margin
 *
 * @param view
 * @param left
 * @param top
 * @param right
 * @param bottom
 * @param width
 * @param height
 */
public void setViewMargin(View view, int left, int top, int right, int bottom, int width, int height) {
    if (view == null) {
        return;
    }
    ViewParent parent = view.getParent();
    if (parent == null) {
        return;
    }
    ViewGroup.MarginLayoutParams lp;
    if (parent instanceof LinearLayout) {
        lp = new LinearLayout.LayoutParams(width, height);
    } else if (parent instanceof RelativeLayout) {
        lp = new RelativeLayout.LayoutParams(width, height);
    } else if (parent instanceof FrameLayout) {
        lp = new FrameLayout.LayoutParams(width, height);
    } else {
        lp = new TableLayout.LayoutParams(width, height);
    }
    if (lp != null) {
        lp.setMargins(left, top, right, bottom);
        view.setLayoutParams(lp);
    }
}
项目:SmartMath    文件:ActivityCfgKeyPad.java   
public void updateLayoutHolder(View vToBeAdded, boolean bRemoveAllFirst)    {
    if (bRemoveAllFirst)    {
        mlLayoutholderInputPadCfg.removeAllViews();
    }
    mlLayoutholderInputPadCfg.addView(vToBeAdded);
    vToBeAdded.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
    if (vToBeAdded instanceof TableLayout)  {
        int nNumofRows = ((TableLayout)vToBeAdded).getChildCount();
        for (int idx = 0; idx < nNumofRows; idx ++) {
            TableRow tr = (TableRow)((TableLayout)vToBeAdded).getChildAt(idx);
            tr.setLayoutParams(new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
            int nNumofBtns = tr.getChildCount();
            for (int idx1 = 0; idx1 < nNumofBtns; idx1 ++)  {
                View vBtn = tr.getChildAt(idx1);
                // height has been set before.
                vBtn.setLayoutParams(new TableRow.LayoutParams(0, vBtn.getLayoutParams().height, 1));
            }
        }
    }
}
项目:StorageAndroidChat    文件:MessageActivity.java   
@Override
protected void onResume() {
    super.onResume();
       pause = false;
       mIsInForegroundMode = true;
       StorageHandler.selfHandler.messagesView = this;
       channel = getIntent().getStringExtra("channel");
       setTitle(channel);
       if (!isFromCompose) {
           TableLayout tableMessages = (TableLayout) findViewById(R.id.tableMessages);
           tableMessages.removeAllViews();
           getItems();
       }
       //loadMsg();

}
项目:StorageAndroidChat    文件:CustomTableRow.java   
public CustomTableRow(Context context, TableLayout container, int type,String content) {
    super(context);

    this.content = content;
    this.container = container;
    this.context = context;

    switch (type) {
           case Config.CHANNEL_NAME:
               setChannelName();
               break;

           case Config.CHANNEL_ADD:
               setChannelAdd();
               break;

           case Config.CHANNEL_DEL:
               setChannelDel();
               break;
           default:
               break;
       }
}
项目:ssj    文件:TabHandler.java   
private void checkVisualFeedbackTabs()
{
    List<Component> visualFeedbacks = PipelineBuilder.getInstance().getComponentsOfClass(PipelineBuilder.Type.EventHandler, VisualFeedback.class);
    removeComponentsOfClass(additionalTabs, VisualFeedback.class);
    if (!visualFeedbacks.isEmpty())
    {
        boolean anyUnmanaged = false;
        TableLayout visualFeedbackLayout = getTableLayoutForVisualFeedback(visualFeedbacks);
        TabHost.TabSpec newTabSpec = getNewTabSpec(visualFeedbackLayout, visualFeedbacks.get(0).getComponentName(), android.R.drawable.ic_menu_compass); // TODO: Change icon.
        for (Component visualFeedback : visualFeedbacks)
        {
            boolean isManaged = PipelineBuilder.getInstance().isManagedFeedback(visualFeedback);

            if(! isManaged)
            {
                anyUnmanaged = true;
                ((VisualFeedback) visualFeedback).options.layout.set(visualFeedbackLayout);
            }
        }
        if(anyUnmanaged)
            additionalTabs.put(visualFeedbacks.get(0), newTabSpec);
    }
}
项目:YalpStore    文件:DeviceInfoActivity.java   
private void addRow(TableLayout parent, String key, String value) {
    TableRow.LayoutParams rowParams = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT);

    TextView textViewKey = new TextView(this);
    textViewKey.setText(key);
    textViewKey.setLayoutParams(rowParams);

    TextView textViewValue = new TextView(this);
    textViewValue.setText(value);
    textViewValue.setLayoutParams(rowParams);

    TableRow tableRow = new TableRow(this);
    tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT, TableLayout.LayoutParams.WRAP_CONTENT));
    tableRow.addView(textViewKey);
    tableRow.addView(textViewValue);

    parent.addView(tableRow);
}
项目:minhaeiro    文件:CategoriaEditarActivity.java   
public void iniciarLayout() {
    setContentView(R.layout.activity_categoria_editar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    progressDialog = new ProgressDialog(this);
    progressDialog.setCanceledOnTouchOutside(false);

    txtNome = (EditText) findViewById(R.id.txtNome);
    tblIcones = (TableLayout) findViewById(R.id.tblIcones);
    categoria = (Categoria) getIntent().getSerializableExtra("categoria");
    this.setTitle(categoria.nome);
    txtNome.setText(categoria.nome);

    if (categoria.icone_id != 0) {
        String tag = getResources().getResourceEntryName(categoria.icone_id);
        View imgEncontrada = obterViewPorTag(tblIcones, tag);
        if (imgEncontrada != null) {
            imgSelecionada = (ImageView) imgEncontrada;
            imgSelecionada.setColorFilter(Color.parseColor("#8BC34A"));
        }
    }
}
项目:AndroidQuiz    文件:GameFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mViewGroup = container;
    View view = inflater.inflate(R.layout.fragment_game, container, false);

    mAnswerLayout = (LinearLayout) view.findViewById(R.id.answer_layout);
    mTableLayout = (TableLayout) view.findViewById(R.id.game_table_layout);
    mResetButton = (ImageButton) view.findViewById(R.id.reset);
    mHintButton = (ImageButton) view.findViewById(R.id.hint);
    mImageView = (ImageView) view.findViewById(R.id.question_image);

    mHintButton.setOnClickListener(this);
    mResetButton.setOnClickListener(this);

    if (mPergunta.acertou()) {
        mHintButton.setVisibility(View.GONE);
        mResetButton.setVisibility(View.GONE);
    }
    return view;
}
项目:app-indexing    文件:RecipeActivity.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.ingredients_fragment, container, false);

    this.recipe = ((RecipeActivity) getActivity()).mRecipe;

    TableLayout table = (TableLayout) rootView.findViewById(R.id.ingredientsTable);
    for (Recipe.Ingredient ingredient : recipe.getIngredients()) {
        TableRow row = (TableRow) inflater.inflate(R.layout.ingredients_row, null);
        ((TextView) row.findViewById(R.id.attrib_name)).setText(ingredient.getAmount());
        ((TextView) row.findViewById(R.id.attrib_value)).setText(ingredient
                .getDescription());
        table.addView(row);
    }

    return rootView;
}
项目:Furfural-Detector    文件:ListaMedidas.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.listamedidas);

    info=(Button) findViewById(R.id.BotonInfo);
    info.setVisibility(INVISIBLE);
    back=(Button) findViewById(R.id.BotonBack);
    back.setOnClickListener(this);

    // Instanciamos CalibradosDataSource para
       // poder realizar acciones con la base de datos
       dataSource = new CalibradosDataSource(this);
       dataSource.open();

    // Instanciamos los elementos
       //lvCalibrados = (ListView) findViewById(R.id.lvCalibrados);
       tabla = (TableLayout)findViewById(R.id.tablaMedidas);
       layoutFila = new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT,TableRow.LayoutParams.WRAP_CONTENT);


       // Cargamos la lista de notas disponibles
       List<Medidas> listaMedidas = dataSource.getAllMedidas();
       agregarFilasTabla(listaMedidas);
}
项目:FingerColoring-Android    文件:PaintActivity.java   
private void initViews() {
    myDialogFactory = new MyDialogFactory(this);
    advanceLay = (LinearLayout) findViewById(R.id.topfirstlay);
    colourImageView = (ColourImageView) findViewById(R.id.fillImageview);
    cColor1 = (ImageView) findViewById(R.id.current_pen1);
    cColor2 = (ImageView) findViewById(R.id.current_pen2);
    cColor3 = (ImageView) findViewById(R.id.current_pen3);
    cColor4 = (ImageView) findViewById(R.id.current_pen4);
    tableLayout = (TableLayout) findViewById(R.id.colortable);
    colorPickerSeekBar = (ColorPicker) findViewById(R.id.seekcolorpicker);
    largecolorpicker = (ColorPicker) findViewById(R.id.largepicker);
    largecolorpickerlay = (LinearLayout) findViewById(R.id.largepickerlay);
    advanceColor = (ImageView) findViewById(R.id.advance_color);
    undo = (ImageButton_define_secondLay) findViewById(R.id.undo);
    redo = (ImageButton_define_secondLay) findViewById(R.id.redo);
    save = (ImageButton_define) findViewById(R.id.save);
    open = (ImageButton_define) findViewById(R.id.open);
    share = (ImageButton_define) findViewById(R.id.share);
    more = (ImageButton_define) findViewById(R.id.more);
    delete = (ImageButton_define) findViewById(R.id.delete);
    pick = (ImageCheckBox_define) findViewById(R.id.pickcolor);
    drawLine = (ImageCheckBox_define) findViewById(R.id.drawline);
    jianbian_color = (ImageCheckBox_define) findViewById(R.id.jianbian_color);
}
项目:RollerBall    文件:choiceLevel.java   
/**
 * Set the view, Charge les données et affiche les boutons d'accés aux levels
 * @param savedInstanceState
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_choice_level);

    loadGameData(this);

    tableLayout = (TableLayout) findViewById(R.id.tableLayout);
    disableButton = BitmapFactory.decodeResource(this.getResources(), R.mipmap.rayure);
    enableButton = BitmapFactory.decodeResource(this.getResources(), R.mipmap.tick);
    DisplayMetrics metrics = new DisplayMetrics();
    getWindowManager().getDefaultDisplay().getMetrics(metrics);

    heightScreen = metrics.heightPixels;
    widhtScreen = metrics.widthPixels;

    int hypothenus = (int) Math.sqrt(Math.pow((int) heightScreen, 2) + Math.pow((int) widhtScreen, 2));
    ratio = (int) (hypothenus / 30.0f);
    loadButton();
}
项目:Wristglider    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    debugMode = BuildConfig.LOG_ENABLED;

    Log.d(TAG, "Created");
    setContentView(R.layout.activity_main);

    prefs = PreferenceManager.getDefaultSharedPreferences(this);

    tablelayout = (TableLayout) findViewById(R.id.tablelayout);
    addTableRow(getString(R.string.pilot_name), Statics.PREFPILOTNAME);
    addTableRow(getString(R.string.glider), Statics.PREFGLIDERARRAY);
    addTableRow(getString(R.string.logger_seconds), Statics.PREFLOGGERSECONDS);
    addTableRow(getString(R.string.logger_autostart), Statics.PREFLOGGERAUTO);
    addTableRow(getString(R.string.enable_ambient), Statics.PREFSCREENON);
    addTableRow(getString(R.string.rotate_view), Statics.PREFROTATEDEGREES);
    addTableRow(getString(R.string.height_unit), Statics.PREFHEIGTHUNIT);
    addTableRow(getString(R.string.speed_unit), Statics.PREFSPEEDUNIT);
    addTableRow(getString(R.string.use_bt_vario), Statics.PREFUSEBTVARIO);
    addTableRow(getString(R.string.vario_unit), Statics.PREFBTVARIOUNIT);

    mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addApi(Wearable.API).build();
}
项目:CoinPryc    文件:SixthActivity.java   
void  addData(String name,Double amount)
{

    LinearLayout Ll = (LinearLayout) findViewById(R.id.linearlayoutinv);
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT,
            TableLayout.LayoutParams.WRAP_CONTENT);
    params.setMargins(5, 5, 5, 5);

    TextView label = new TextView(this);

    label.setText("You can invest Rs."+amount+" in "+name+ " ");
    if (amount==((iamount*0.4)/2))
    {
        label.setTextColor(Color.BLUE);
    }
    else if(amount==((iamount*0.4)/4))
    {
        label.setTextColor(Color.CYAN);
     }
     else
    {
        label.setTextColor(Color.MAGENTA);
    }
    label.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,
            TableLayout.LayoutParams.WRAP_CONTENT));
    label.setPadding(5, 5, 5, 5);
    label.setBackgroundColor(Color.WHITE);

    params.setMargins(5, 5, 5, 5);
    //Ll.setPadding(10, 5, 5, 5);
    Ll.addView(label, params);


}
项目:pokequest    文件:PokeDetailActivity.java   
private void appendRowInfo(TableLayout table, String key, String value) {
    TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout
            .pokemon_info_table_row, null);
    ((TextView) row.findViewById(R.id.attrib_name)).setText(key);
    ((TextView) row.findViewById(R.id.attrib_value)).setText(value);
    table.addView(row);
}
项目:pokequest    文件:PokeDetailActivity.java   
private void appendRowBaseStat(TableLayout table, String key, int value) {
    TableRow row = (TableRow) this.getLayoutInflater().inflate(R.layout
            .pokemon_base_stat_table_row, null);
    ((TextView) row.findViewById(R.id.attrib_name)).setText(key);
    ((TextView) row.findViewById(R.id.attrib_value)).setText(String.valueOf(value));
    ((ProgressBar) row.findViewById(R.id.progressbar_stat)).setProgress(value);
    table.addView(row);
}
项目:CP-Tester    文件:ViewHelper.java   
public static TableLayout getTableView(Context context){
    TableLayout table = new TableLayout(context);
    table.setLayoutParams(new TableLayout.LayoutParams(
            TableLayout.LayoutParams.MATCH_PARENT,
            TableLayout.LayoutParams.MATCH_PARENT));
    return table;
}
项目:FlexibleRichTextView    文件:FlexibleRichTextView.java   
private View getHorizontalDivider() {
    View horizontalDivider = new View(mContext);
    horizontalDivider.setLayoutParams(new TableLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 1));
    horizontalDivider.setBackgroundColor(ContextCompat.getColor(mContext, android.R.color.black));

    return horizontalDivider;
}
项目:editor-sql    文件:SqlCreateTableActivity.java   
@Override
void findViews() {
    EventBus.getDefault().register(this);
    mRecycleView = (RecyclerView) findViewById(R.id.sql_tabs_recycleview);
    mTabHeader = (TableLayout) findViewById(R.id.sql_tabview_header_tab);
    mEmptyRefreshLayout = (SwipeRefreshLayout) findViewById(R.id.empty_view_container);
    setRefreshLayoutImpl(mEmptyRefreshLayout);
}
项目:Nearby    文件:AllInOneInquiryVitalListCustomAdapter.java   
public ViewHolder(View v) {
    super(v);
    cv = (CardView)v.findViewById(R.id.cv);
    setCardButtonOnTouchAnimation(cv);
    tv_dateTitle = (TextView)v.findViewById(R.id.tv_date_title);
    tl = (TableLayout)v.findViewById(R.id.tl);
}
项目:Nearby    文件:AllInOneInquiryListCustomAdapter.java   
public ViewHolder(View v) {
    super(v);
    cv = (CardView)v.findViewById(R.id.cv);
    setCardButtonOnTouchAnimation(cv);
    tv_dateTitle = (TextView)v.findViewById(R.id.tv_date_title);
    tl = (TableLayout)v.findViewById(R.id.tl);
}
项目:Nearby    文件:InquiryDateDetailActivity.java   
private void makeRemarkList(){

        if(remarks.size() > 0){
            tv_msg_remark.setVisibility(View.GONE);
        }else{
            tv_msg_remark.setVisibility(View.VISIBLE);
        }

        for(PatientRemark pr : remarks){

            TableLayout.LayoutParams tlps=new TableLayout.LayoutParams(TableLayout.LayoutParams.WRAP_CONTENT,TableLayout.LayoutParams.WRAP_CONTENT);
            TableRow.LayoutParams trps=new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT,TableRow.LayoutParams.WRAP_CONTENT);

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

            TextView tv_title = new TextView(this);
            tv_title.setText(pr.getDescription());
            tv_title.setLayoutParams(trps);
            tv_title.setTextColor(getColorId(R.color.dark_gray));
            tv_title.setGravity(Gravity.CENTER);
            tv_title.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    getResources().getDimension(R.dimen.default_font_small_size));

            TextView tv_time = new TextView(this);
            tv_time.setText(AdditionalFunc.getTimeString(pr.getRegisteredDate()));
            tv_time.setLayoutParams(trps);
            tv_time.setTextColor(getColorId(R.color.dark_gray));
            tv_time.setGravity(Gravity.CENTER);
            tv_time.setTextSize(TypedValue.COMPLEX_UNIT_PX,
                    getResources().getDimension(R.dimen.default_font_small_size));

            tr.addView(tv_title);
            tr.addView(tv_time);

            tl_remark.addView(tr, tlps);
        }

    }
项目:biniu-index    文件:CoinFragment.java   
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.coin_layout, container, false);

    if (Cache.topDivs == null || Cache.topDivs.equals("")) return rootView;

    TableLayout tl = (TableLayout) rootView.findViewById(R.id.item_table);

    try {
        JSONObject obj = new JSONObject(Cache.bottomDivs);
        Iterator<String> keys = obj.keys();
        while (keys.hasNext()) {
            String key = keys.next();

            String market = key.split("-")[0];
            if (!market.contains("btc")) continue;

            String strType = key.split("-")[1];

            TableLayout tlx = (TableLayout) inflater.inflate(R.layout.item_layout, container, false);

            TextView level = (TextView) tlx.findViewById(R.id.level);
            TextView reliability = (TextView) tlx.findViewById(R.id.reliability);
            TextView time = (TextView) tlx.findViewById(R.id.div_time);

            level.setText(strType);
            reliability.setText(obj.getJSONObject(key).getDouble("reliability") + "");
            time.setText(obj.getJSONObject(key).getString("cur_div_time"));

            tl.addView(tlx);
        }

    } catch (JSONException e) {
        e.printStackTrace();
    }

    return rootView;
}
项目:MyFlightbookAndroid    文件:ActCurrency.java   
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));
        }
    }
}
项目:TitanCompanion    文件:SSAdventureMapFragment.java   
public void setClearingLayoutSizes(View rootView, Context context) {

        DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
        float dpHeight = displayMetrics.heightPixels / displayMetrics.density;
        float dpWidth = displayMetrics.widthPixels / displayMetrics.density;

        dpHeight -= addClearingButton.getHeight();

        dpHeight /= 9;
        dpWidth /= 7;


        int finalValue = (int) Math.min(dpHeight, dpWidth);

        TableLayout table = rootView.findViewById(R.id.clearingGrid);
        final int childcount = table.getChildCount();
        for (int i = 0; i < childcount; i++) {
            TableRow row = (TableRow) table.getChildAt(i);

            final int cellCount = row.getChildCount();
            for (int j = 0; j < cellCount; j++) {
                TextView cell = (TextView) row.getChildAt(j);
                cell.setHeight(finalValue);
                cell.setWidth(finalValue);
            }


        }
    }
项目:RepWifiApp    文件:SelectNetworkActivity.java   
private void addButtonForNetwork(AccessPointInfo info) {

        TableLayout s = (TableLayout) findViewById(R.id.table_networks);
        TableLayout.LayoutParams tableParams = new TableLayout.LayoutParams(
                        LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
        TableRow row = new TableRow(this);
        TableRow.LayoutParams rowParams = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,
                        LayoutParams.WRAP_CONTENT);
        rowParams.gravity = Gravity.FILL_HORIZONTAL;
        row.setPadding(10, 10, 10, 10);
        row.setLayoutParams(rowParams);
        row.setGravity(Gravity.FILL_HORIZONTAL);
        row.setLayoutParams(rowParams);

        NetworkButton button = new NetworkButton(this, info.getBssid());

        TableRow.LayoutParams params = new TableRow.LayoutParams(LayoutParams.MATCH_PARENT,
                        LayoutParams.WRAP_CONTENT);
        button.setLayoutParams(params);
        button.setBackground(getResources().getDrawable(R.drawable.repwifi_button));
        button.setTextColor(Commons.colorThemeLight);
        button.setTextSize(20);
        button.setPadding(25, 10, 25, 10);
        button.setGravity(Gravity.CENTER_HORIZONTAL);
        button.setText(info.getSsid(20));
        button.setOnClickListener(this);

        row.addView(button, params);
        row.setGravity(Gravity.CENTER_HORIZONTAL);
        s.addView(row, tableParams);
        s.setGravity(Gravity.FILL_HORIZONTAL);

    }
项目:Animations    文件:AppearAnimationActivity.java   
private static List<TableRow> getRows (TableLayout table) {
    List<TableRow> list = new ArrayList<>(table.getChildCount());
    for(int i = 0, j = table.getChildCount(); i < j; i++) {
        View view = table.getChildAt(i);
        if (view instanceof TableRow) {
            TableRow row = (TableRow) view;
            list.add(row);
        }
    }
    return list;
}
项目:CS4160-trustchain-android    文件:PeerListAdapter.java   
private void setOnClickListener(TableLayout mTableLayoutConnection, int position) {
    mTableLayoutConnection.setTag(position);
    View.OnClickListener onClickListener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            int pos = (int) v.getTag();
            PeerAppToApp peer = getItem(pos);
            Intent intent = new Intent(context, TrustChainActivity.class);
            intent.putExtra("PeerAppToApp", peer);
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    };
    mTableLayoutConnection.setOnClickListener(onClickListener);
}