如何修改pfpj的服务器,如何更改布局?
您可以使用一個布局和一個活動。你必須隱藏/顯示你的布局按鈕click.i已經實現了它。你可以嘗試下面的code.may它會幫助你。
main.xml中
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="20"
android:gravity="center_horizontal"
android:text="layout 1" />
android:id="@+id/btn1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="layout 1" />
android:id="@+id/layout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:visibility="gone" >
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="layout 2" />
android:id="@+id/btn2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="layout 2" />
MyActivity.java
public class MyActivity extends Activity {
Button btn1, btn2;
LinearLayout layout1, layout2;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_layout);
btn1 = (Button) findViewById(R.id.btn1);
btn2 = (Button) findViewById(R.id.btn2);
layout1 = (LinearLayout) findViewById(R.id.layout1);
layout2 = (LinearLayout) findViewById(R.id.layout2);
btn1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
layout1.setVisibility(View.GONE);
layout2.setVisibility(View.VISIBLE);
}
});
btn2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
layout1.setVisibility(View.VISIBLE);
layout2.setVisibility(View.GONE);
}
});
}
}
總結
以上是生活随笔為你收集整理的如何修改pfpj的服务器,如何更改布局?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 会计电算化的重要物质基础计算机和,湖北工
- 下一篇: wdcp服务器/虚拟主机管理系统,wdc