2014-09-08 4 views
1

사용자가 왼쪽의 녹색 버튼을 클릭 한 후 셀 3과 5에 사각형 (테두리)을 어떻게 추가합니까?버튼을 클릭했을 때 셀에 테두리를 추가하는 방법은 무엇입니까?

지금은 아래 그림과 같이 "경고"를 인쇄하고 있습니다. 나는 사각형 셀 3의 특정와 5

을 만들고 싶어 exambple

@Override 
    protected ArrayList<CellVO> transformRowCells(Node node) 
    { 
     String symbol = Commons.xml_getAttribute(node, "symbol"); 
     String samount = StringExtra.stringAsMathUserfriendlyWithString(Commons.xml_getAttribute(node, "samount"), symbol); 
     String srate = Commons.xml_getAttribute(node, "srate"); 
     String spl = StringExtra.stringAsRoundedWithString(Commons.xml_getAttribute(node, "spl")); 
     String lamount = StringExtra.stringAsMathUserfriendlyWithString(Commons.xml_getAttribute(node, "lamount"), symbol); 
     String lrate = Commons.xml_getAttribute(node, "lrate"); 
     String lpl = StringExtra.stringAsRoundedWithString(Commons.xml_getAttribute(node, "lpl")); 

     int lplColor = CommonsParitem.colorForStringFromPL2(lpl); 
     int splColor = CommonsParitem.colorForStringFromPL2(spl); 
     if(lplColor == 0) lplColor = CommonsParitem.defaultTextColorGray(); 
     if(splColor == 0) splColor = CommonsParitem.defaultTextColorGray(); 

//Log.d("custom", node + ", spl: "+spl+", lpl: "+lpl); 

     CellVO cell0 = new CellVO(16, symbol, Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); 
     CellVO cell1 = new CellVO(13, lamount, Gravity.RIGHT | Gravity.CENTER_VERTICAL); 
     CellVO cell2 = new CellVO(13, lrate, Gravity.RIGHT | Gravity.CENTER_VERTICAL); 
     CellVO cell3 = new CellVO(12, lpl, Gravity.RIGHT | Gravity.CENTER_VERTICAL, lplColor); 
     CellVO cell4 = new CellVO(12, samount, Gravity.RIGHT | Gravity.CENTER_VERTICAL); 
     CellVO cell5 = new CellVO(14, srate, Gravity.RIGHT | Gravity.CENTER_VERTICAL); 
     CellVO cell6 = new CellVO(13, spl, Gravity.RIGHT | Gravity.CENTER_VERTICAL, splColor); 

// icon cell 
     CellVO cell7 = new CellVO(); 
     cell7.widthPercent = 5; 
     cell7.imgIcon = Commons.isTablet() ? R.drawable.tb_table_cell_btn_x : (didPozEdited(node) ? R.drawable.poz_acikislem_edit1 : R.drawable.poz_acikislem_edit0); 

     cell7.setCustomEventListener(new CellVO.OnIconTapListener() { 
      @Override 
      public void onIconTap(View v) { 

       Log.v("Info","Warning"); 

      } 
     }); 

     ArrayList<CellVO> cells = new ArrayList<CellVO>(); 
     cells.add(cell7); 
     cells.add(cell0); 
     cells.add(cell1); 
     cells.add(cell2); 
     cells.add(cell3); 
     cells.add(cell4); 
     cells.add(cell5); 
     cells.add(cell6); 

     return cells; 
    } 

내 XML 파일 :

<menu xmlns:android="http://schemas.android.com/apk/res/android"> 
<item android:id="@+id/menu_settings" 
    android:title="@string/menu_settings" 
    android:orderInCategory="100" 
    android:showAsAction="never" /> 

답변

0

사용이 rectangle.xml :

<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > 
    <solid android:color="#ffffff" /> 
    <stroke android:width="1dip" android:color="#ff0000"/> 
</shape> 

버튼 녹색 버튼 onClick()

TextView t1 = (TextView) findViewById(R.id.rowtext3); 
t1.setBackgroundResource(R.drawable.rectangle); 
+0

.xml 파일에 아무 것도 쓰지 않고 프로그래밍 할 수 있습니까? – CAN

+0

잘 내 지식 당 이것은 올바른 방법이며 코드를 줄일 수 있습니다. –

+0

안녕하세요 당신 문제에 대한 해결책을 찾았습니까? –

관련 문제