daily pastebin goal
29%
SHARE
TWEET

Untitled

a guest Feb 20th, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <RelativeLayout
  2.     android:id="@+id/date_bar_layout"
  3.     android:layout_width="fill_parent"
  4.     android:layout_height="wrap_content"
  5.     android:layout_below="@+id/navigation_bar_layout"
  6.     android:background="@color/light_gray"
  7.     android:gravity="center">
  8.  
  9.     <TextView
  10.         android:id="@+id/detaildatetextview"
  11.         android:layout_width="wrap_content"
  12.         android:layout_height="wrap_content"
  13.         android:layout_centerInParent="true"
  14.         android:text=""
  15.         android:textColor="@color/black"
  16.         android:textSize="20dp"
  17.         android:textStyle="bold" />
  18. </RelativeLayout>
  19.    
  20. image  = new ImageView(getApplicationContext());
  21. image.setId(0);
  22. dateText = (TextView) dateBarLayout.findViewById(R.id.detaildatetextview);
  23. dateText.setText("Dummy text");
  24. RelativeLayout.LayoutParams params = (LayoutParams) dateBarLayout.getLayoutParams();
  25. params.addRule(RelativeLayout.LEFT_OF, dateText.getId());                      
  26. String icon = "drawable/"+ path;
  27. icon = icon.replaceAll("-", "_");
  28. icon = icon.toLowerCase();
  29. int imageResource = this.getApplicationContext().getResources().getIdentifier(icon, null,this.getApplicationContext().getPackageName());
  30. image.setImageResource(imageResource);
  31. dateBarLayout.addView(image);
  32.    
  33. image  = new ImageView(getApplicationContext());
  34.     image.setId(0);
  35.  
  36.     dateText = (TextView) dateBarLayout.findViewById(R.id.detaildatetextview);
  37.  
  38.     dateText.setText("Dummy text");
  39.  
  40.  
  41.  
  42.         RelativeLayout.LayoutParams params = (LayoutParams) dateBarLayout.getLayoutParams();
  43.     params.addRule(RelativeLayout.LEFT_OF, dateText.getId());
  44.  
  45.         String icon = "drawable/"+ path;
  46.         icon = icon.replaceAll("-", "_");
  47.             icon = icon.toLowerCase();
  48.  
  49.         int imageResource = this.getApplicationContext().getResources().getIdentifier(icon, null,this.getApplicationContext().getPackageName());
  50.  
  51.         image.setImageResource(imageResource);
  52.                     dateBarLayout.addView(image, params);
  53.    
  54. ImageView image = new ImageView(this);
  55. RelativeLayout dateBarLayout=(RelativeLayout)findViewById(R.id.date_bar_layout);
  56. TextView dateText = (TextView) dateBarLayout.findViewById(R.id.detaildatetextview);
  57. RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  58. params.addRule(RelativeLayout.LEFT_OF, dateText.getId());
  59. image.setLayoutParams(params);
  60. image.setImageResource(R.drawable.ic_launcher);
  61. dateBarLayout.addView(image);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top