I cannot read the AttributeSet from my XML resources

后端 未结 2 806
死守一世寂寞
死守一世寂寞 2021-02-07 17:22

I\'m trying to read an AttributeSet from an XML resource file. The relevant code is the following:

//This happens inside an Activity
        Resources r = getRe         


        
2条回答
  •  隐瞒了意图╮
    2021-02-07 18:12

    If I understand right, you need to read the attributes from the TextView for example the Text inside the TextView or the ID and so on?

    I would make it as follows:

    TextView text_res = (TextView) findViewById(R.id.TextView01);
    
    String text_inTextView;
    String id_fromTextView;
    
    text_inTextView = text_res.getText();
    id_fromTextView = String.valueOf(text_res.getId());
    

    and so on...

    I hope this is what you need.

提交回复
热议问题