0

我是開發Android應用程序的新手。我有4個EditText對應4個TextView.but但我有一個EditTexts問題,它們不適合正確使用。如何處理此問題。以下是我的XML佈局文件。請幫助我,什麼是錯誤的。謝謝你提前。在佈局Gridlayout中的UI組件不適合並且它們正在流動

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" 
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin" 
android:paddingRight="@dimen/activity_horizontal_margin" 
android:paddingTop="@dimen/activity_vertical_margin" 
android:paddingBottom="@dimen/activity_vertical_margin" 
tools:context="com.example.mobilecoursemanagementsystem.AddCourseActivity" 
android:orientation="vertical"> 

<GridLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:rowCount="5" 
    android:columnCount="3"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Course Title" 
     android:layout_column="0" 
     android:layout_row="0" 
     android:id="@+id/txtTitle"/> 
    <!--android:layout_marginTop="10dp"--> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_column="1" 
     android:layout_row="0" 
     android:layout_marginTop="10dp" 
     android:id="@+id/editTitle" /> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_column="0" 
     android:layout_row="1" 
     android:layout_marginTop="10dp" 
     android:text="Course Code" 
     android:id="@+id/txtCode"/> 

    <EditText 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_column="1" 
     android:layout_row="1" 
     android:layout_marginTop="10dp" 
     android:id="@+id/editCode" /> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_column="0" 
     android:layout_row="2" 
     android:layout_marginTop="10dp" 
     android:text="Number of Student" 
     android:id="@+id/txtNumberOfSts"/> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_column="1" 
     android:layout_row="2" 
     android:layout_marginTop="10dp" 
     android:id="@+id/editNumberOfSts" /> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_column="0" 
     android:layout_row="3" 
     android:layout_marginTop="10dp" 
     android:text="Course Level" 
     android:id="@+id/txtLevel"/> 

    <EditText 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_column="1" 
     android:layout_row="3" 
     android:layout_marginTop="10dp" 
     android:id="@+id/editLevel" /> 
</GridLayout> 
</LinearLayout> 

click for Screenshoot

回答

0

用戶layout_margins每一個的EditText

android:layout_marginRight="10dp" 

設定任何值,你喜歡保證金

+0

不幸的是,它沒有工作,任何變化:( – 2014-12-02 20:44:23

+0

沒有完全工作,我不明白 – 2014-12-02 21:14:57

相關問題