Skip to content

Instantly share code, notes, and snippets.

@agiletalk
Created April 13, 2011 10:44
Show Gist options
  • Save agiletalk/917341 to your computer and use it in GitHub Desktop.
Save agiletalk/917341 to your computer and use it in GitHub Desktop.
[예제] 실행 중에 속성 바꾸기
package org.catchabug.LayoutGravityTest;
import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
public class LayoutGravityTest extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
LinearLayout MyLinear = (LinearLayout)findViewById(R.id.MyLinear);
MyLinear.setOrientation(LinearLayout.HORIZONTAL);
Button MyBtn = (Button)findViewById(R.id.MyButton);
MyBtn.setTextSize(40);
EditText MyEdit = (EditText)findViewById(R.id.MyEdit);
MyEdit.setBackgroundColor(0xff00ff00);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/MyLinear"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/MyButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="버튼"
/>
<TextView
android:id="@+id/MyText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="문자열"
/>
<EditText
android:id="@+id/MyEdit"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="에디트"
/>
</LinearLayout>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment