2012-01-31 116 views
0

請幫助我創建此程序。我不知道這個程序在一個狀態下如何水平滾動。我可以得到一些幫助來添加此程序中的代碼?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="wrap_content" 
    android:background="@drawable/indonesia"> 

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Indonesia - Inggris - Jerman" />  

<TextView 
    android:text="Indonesia :" 
    android:id="@+id/TextView01" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 

<EditText 
    android:text="" 
    android:id="@+id/txtIndo" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" /> 
<Button 
    android:text="Terjemahkan" 
    android:id="@+id/btnTerjemah" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:onClick="getTerjemahan" /> 

<TextView 
android:text="Inggris :" 
android:id="@+id/TextView03" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" /> 

<EditText 
android:text="" 
android:id="@+id/txtIngg" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:editable="false" /> 

<TextView 
android:text="Jerman :" 
android:id="@+id/TextView04" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" /> 

<EditText 
android:text="" 
android:id="@+id/txtJer" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:editable="false" /> 
<Button 
android:text="Kembali ke Menu" 
android:id="@+id/btnBack" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:onClick="backtoMenu"/> 

</LinearLayout> 

我的意思是這樣的。 第一,我的程序在vertical.please訪問我的鏈接,因爲有我的照片。 vertical layout

問題是如果我在橫向滾動程序。檢查佈局,我不能向下滾動這個佈局。 horizontal trouble layout

+0

做喲想在這個線性佈局水平滾動條?意味着你想要顯示所有在這裏出現的元素,對嗎? – 2012-01-31 11:12:47

+0

你能對你想要的東西做更具體的描述嗎? – 2012-01-31 11:25:53

回答

1
<?xml version="1.0" encoding="utf-8"?> 
    <ScrollView 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:background="@drawable/indonesia" 
    android:orientation="horizontal" > 

    <TextView 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Indonesia - Inggris - Jerman" /> 

    <TextView 
     android:id="@+id/TextView01" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Indonesia :" /> 

    <EditText 
     android:id="@+id/txtIndo" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="" /> 

    <Button 
     android:id="@+id/btnTerjemah" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:onClick="getTerjemahan" 
     android:text="Terjemahkan" /> 

    <TextView 
     android:id="@+id/TextView03" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Inggris :" /> 

    <EditText 
     android:id="@+id/txtIngg" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:editable="false" 
     android:text="" /> 

    <TextView 
     android:id="@+id/TextView04" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:text="Jerman :" /> 

    <EditText 
     android:id="@+id/txtJer" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:editable="false" 
     android:text="" /> 

    <Button 
     android:id="@+id/btnBack" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:onClick="backtoMenu" 
     android:text="Kembali ke Menu" > 
    </Button> 
</LinearLayout> 
</ScrollView> 
+0

請保持它親愛的 – 2012-01-31 11:27:39

+0

@RameshSolanki thanx – nirav 2012-02-01 04:16:40

0

他們也是一個小工具,讓您的視圖滾動水平:

<HorizontalScrollView 
xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"> 
<LinearLayout 

android:layout_width="fill_parent" 
android:layout_height="wrap_content" 
android:background="@drawable/indonesia" 
android:orientation="horizontal" > 

<TextView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Indonesia - Inggris - Jerman" /> 

<TextView 
    android:id="@+id/TextView01" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Indonesia :" /> 

<EditText 
    android:id="@+id/txtIndo" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="" /> 

<Button 
    android:id="@+id/btnTerjemah" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:onClick="getTerjemahan" 
    android:text="Terjemahkan" /> 

<TextView 
    android:id="@+id/TextView03" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Inggris :" /> 

<EditText 
    android:id="@+id/txtIngg" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:editable="false" 
    android:text="" /> 

<TextView 
    android:id="@+id/TextView04" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="Jerman :" /> 

<EditText 
    android:id="@+id/txtJer" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:editable="false" 
    android:text="" /> 

<Button 
    android:id="@+id/btnBack" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:onClick="backtoMenu" 
    android:text="Kembali ke Menu" > 
</Button> 
</LinearLayout> 
</HorizontalScrollView>