우선 안드로이드 프로그래밍의 초보자입니다. 답안에 자세히 설명해주십시오.Android : 리소스 레이아웃 파일을 팽창시킬 때 내 사용자 인터페이스가 그려지지 않는 이유는 무엇입니까?
내가 내 자바 소스 파일에서
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:orientation = "vertical"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent">
<LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android"
android:orientation = "horizontal"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent">
<EditText
android:id="@+id/a"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<TextView
android:id="@+id/xSquared"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/equationPart1"
/>
</LinearLayout>
<LinearLayout
...
</LinearLayout>
</LinearLayout>
와 유사한 형식의 레이아웃 main.xml에 파일을 가지고, 내가 명령을 사용하여 UI를 부풀려 : 된 setContentView (R.layout.main)를;
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
그러나 에뮬레이터를 실행하면 예상대로 UI가 표시되지 않습니다. 대신 간단한 EditText 텍스트 상자 만 표시합니다.
나는 무엇이 잘못되고 있는지 궁금합니다. 레이아웃을 다른 레이아웃에 배치했기 때문입니까? 나는 그 문제에 어떤 문제가 있다고 생각하지 않습니까?
문제점을 발견했습니다. 범인은 android : layout_width = "fill_parent"입니다. 첫 번째 EditText 텍스트 상자에 전체 화면을 채우라고 말하기 때문에 다른 구성 요소가 화면 오른쪽으로 스쿠 트가되어 보이지 않습니다. – Einiosaurus