LinearLayout mLay = (LinearLayout)getLayoutInflater().inflate(R.layout.activity_main, null);
TextView txt = (TextView)mLay.findViewById(R.id.show_bar_text);
txt.setText("Hellow");
ImageView color = (ImageView)mLay.findViewById(R.id.show_bar_color);
Toast.makeText(this, "^^ : " + color.getMeasuredWidth(), 1).show(); //여기서 값이 0이 나옴
Toast.makeText(this, "^^ : " + color.getWidth(), 1).show(); //여기서 값이 0이 나옴
this.setContentView(mLay);
위의 ImageView의 width(가로 폭)을 알고 싶은데 방법이 어떻게 구할수 있을까요?
ImageView color의 xml부분은....
<ImageView
android:id="@+id/show_bar_color"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/bgcolor"
android:src="@null"
/>