Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. public class lineChartView extends View implements WeatherMan.weatherReceiver {
  2.  
  3. public lineChartView(Context ctx, String selector) {
  4. super(ctx);
  5. this.context = ctx;
  6. this.selector = selector;
  7. this.setBackgroundColor(Color.RED);
  8. init(null, 0);
  9. }
  10.  
  11. ViewGroup page = (ViewGroup) inflater.inflate(R.layout.view_history, null);
  12.  
  13. lineChartView temperature = new lineChartView(this.getApplicationContext(),"temperature_f");
  14. page.addView(temperature);
  15.  
  16. public lineChartWrapper(Context ctx, String selector) {
  17. super(ctx);
  18. this.context = ctx;
  19. this.selector = selector;
  20. this.setWillNotDraw(false);
  21.  
  22. LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  23. inflater.inflate(R.layout.view_line_chart, this, true);
  24.  
  25. this.lineChart = new lineChartView(this.context, this.selector);
  26.  
  27. this.addView(lineChart);
  28. }
  29.  
  30. @Override
  31. protected void onDraw(Canvas canvas) {
  32. super.onDraw(canvas);
  33. this.lineChart.draw(canvas);
  34. }
  35.  
  36. <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  37. xmlns:tools="http://schemas.android.com/tools"
  38. android:layout_width="match_parent"
  39. android:layout_height="100dp"
  40. tools:context="com.blah.deblah.lineChartWrapper">
  41.  
  42. <TextView
  43. android:id="@+id/chart_title"
  44. android:text="Title"
  45. android:textColor="#cccccc"
  46. android:textStyle="normal"
  47. android:textSize="36dp"
  48. android:layout_width="match_parent"
  49. android:layout_height="wrap_content" />
  50.  
  51. </RelativeLayout>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement