java类:

package tk.layout_03;

import android.os.Bundle; 
import android.app.Activity; 
import android.view.Menu;

public class Layout03 extends Activity {

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
        super.onCreate(savedInstanceState); 
        setContentView(R.layout.layout03); 
    }

    @Override 
    public boolean onCreateOptionsMenu(Menu menu) { 
        getMenuInflater().inflate(R.menu.layout03, menu); 
        return true; 
    } 
}

XML文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" >

    <TextView 
        android:id="@ id/label" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:text="Type here:" 
        ></TextView> 
    <EditText 
        android:id="@ id/entry" 
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content" 
        android:background="@android:drawable/editbox_background" 
        android:layout_below="@id/label" 
        /> 
    <Button 
        android:id="@ id/ok" 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_below="@id/entry" 
        android:layout_alignParentRight="true" 
        android:layout_marginLeft="10px" 
        android:text="OK" 
        /> 
    <Button 
        android:layout_width="wrap_content" 
        android:layout_height="wrap_content" 
        android:layout_toLeftOf="@id/ok" 
        android:layout_alignTop="@id/ok" 
        android:text="Cancel" 
        /> 
    
</RelativeLayout>

相关文章:

  • 2021-10-01
  • 2022-01-04
  • 2021-07-15
  • 2021-06-27
  • 2021-10-17
  • 2021-09-23
  • 2022-12-23
  • 2021-11-17
猜你喜欢
  • 2021-09-21
  • 2021-06-28
  • 2021-11-30
  • 2021-11-17
  • 2021-10-24
  • 2021-11-17
相关资源
相似解决方案