내가 여기있는 것은 사용자 정의보기이며 일부 위젯이 함께 표시되도록하고 싶습니다.사용자 정의보기 버튼
<com.zone.manager.Tab3
android:id="@+id/tab3_display"
android:layout_width="fill_parent"
android:layout_height="620dp" >
<Button
android:id="@+id/addZone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add Zone" />
</com.zone.manager.Tab3>
는 지금은
addZone = (Button) findViewById(R.id.addZone);
addZone.setOnClickListener(this);
내가 설정 ... 그래서 이런 짓을 내가보기 클래스에서 함께 물건을 할 수 있도록 OnClickListener를 위해 그 버튼 세트를 갖고 싶어 그
을에 내가 뷰 그룹을 확장 할 때
public class Tab3 extends ViewGroup implements OnTouchListener, OnClickListener
Public Tab3(Context context, AttributeSet attrs)
{
super (context, attrs);
// here
}
은 날이
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b)
{
// TODO Auto-generated method stub
}
을 구현했다
이 작품을 만들기 위해 내가 여기에 넣어야 할 것이 있습니까?
그러나 내가 앱을 실행하려고하면, // addZone.setOnClickListener(this);
밖으로 앱이 정상적으로 실행되면 나에게 도움이됩니까?
탭
당신의 XML로 th.setup();
TabSpec specs = th.newTabSpec("tag0");
specs.setContent(R.id.connecttionTab);
specs.setIndicator("Connection Tab");
th.addTab(specs);
specs = th.newTabSpec("tag1");
specs.setContent(R.id.tab1);
specs.setIndicator("Zone Manager");
th.addTab(specs);
specs = th.newTabSpec("tag2");
specs.setContent(R.id.tab2);
specs.setIndicator("",res.getDrawable(R.drawable.ic_tab_vaccontrol));
th.addTab(specs);
//this is the tab that has all this vvv
specs = th.newTabSpec("tag3");
specs.setContent(R.id.tab3);
specs.setIndicator("Graphical Layout");
th.addTab(specs);
ViewGroup으로 변경했을 때 Button이 Tab3 요소 안에 중첩 된 하위 요소가되도록 XML도 변경 했습니까? 게시 한 XML처럼 뒤따라 오면 여전히 findViewById에 의해 발견되지 않습니다. 그리고 네, 각각의 자식 요소 (이 경우 버튼 만)가 부모 Tab3 요소의 경계 내에 배치되어야하는 위치를 결정하려면 onLayout을 구현해야합니다. –
미안하지만 나는 그것이 의미하는 것을 이해하지 못한다. 나 한테 설명 해줄 수 있니? –
내 대답에 내 첫 번째 샘플 XML 코드를 참조하십시오. 첫 번째 태그는'Tab3' 요소를 끝내지 않습니다. ('/'대신에'>'로 끝나며'Button' 태그 이후에 태그가 있습니다.)'Button' 엘리먼트는 자식이고, 형제 자매 'Tab3'. –