Zahdan Ginga Firme
Zahdan Ginga Firme

Reputation: 1

horizontal scroll issue on android

Please help me with this program that I created. I do not know how this program scrolls horizontally when in a state. Can I get some help to add the code in this program?

Thank you in advance (sorry for my english).

<?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>

I mean like this. the first, my program in vertical.please visit to my link cause there is my picture. vertical layout

the problem's if I make the program in horizontal scroll. check the layout, i can't scroll down this layout. horizontal trouble layout

Upvotes: 0

Views: 386

Answers (2)

deepak Sharma
deepak Sharma

Reputation: 1641

Their is also a widget to make your view scrolling horizontal:

<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>

Upvotes: 0

nirav
nirav

Reputation: 421

  <?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>

Upvotes: 1

Related Questions