Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. TypedArray a = context.getTheme().obtainStyledAttributes(attrs,
  2.         R.styleable.LovelyView, 0, 0);
  3. try {
  4.     // get the text and colors specified using the names in attrs.xml
  5.     leftLabel = a.getString(R.styleable.LovelyView_leftLabel);
  6.     rightLabel = a.getString(R.styleable.LovelyView_rightLabel);
  7.     leftStyle = a.getResourceId(R.styleable.LovelyView_leftLabelStyle, android.R.style.TextAppearance_DeviceDefault);
  8.     rightStyle = a.getResourceId(R.styleable.LovelyView_rightLabelStyle, android.R.style.TextAppearance_DeviceDefault);
  9.  
  10. } finally {
  11.     a.recycle();
  12. }
  13.  
  14. LayoutInflater.from(context).inflate(R.layout.key_value_layout, this);
  15.  
  16. //left text view
  17. leftTextView = (TextView) this.findViewById(R.id.leftTextView);
  18. leftTextView.setText(leftLabel);
  19. leftTextView.setTextAppearance(context, leftStyle);
  20.  
  21. //right text view
  22. rightTextView = (TextView) this.findViewById(R.id.rightTextView);
  23. rightTextView.setText(rightLabel);
  24. rightTextView.setTextAppearance(context, rightStyle);