title: Enable horizontal scroll in linear layout
body: <p>This is my layout without scroll and the out is <a href="http://i.stack.imgur.com/QQeXd.png" rel="nofollow">http://i.stack.imgur.com/QQeXd.png</a> . Inside the "AlphebtesLinearLayout" I am creating listView dynamically. And still some portion is hidden at right so I need to go for Horizontal scroll. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
          &lt;LinearLayout
              android:id="@+id/AlphebtesLinearLayout"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="horizontal" &gt;
          &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>After adding horizontal scroll my output is this <a href="http://i.stack.imgur.com/ki86x.png" rel="nofollow">http://i.stack.imgur.com/ki86x.png</a> the list disappears. Plz help me how to add horizontal scroll.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:orientation="vertical" &gt;
  
  
  &lt;HorizontalScrollView 
      android:layout_height="wrap_content" 
      android:layout_width="match_parent"&gt;
          &lt;LinearLayout
              android:id="@+id/AlphebtesLinearLayout"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:orientation="horizontal" &gt;
          &lt;/LinearLayout&gt;
  
  &lt;/HorizontalScrollView&gt;
  &lt;/LinearLayout&gt;
  
  
  
  protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.tamil_alphabets);
  
  
      }
      @Override
      public void onWindowFocusChanged(boolean hasFocus) {
          super.onWindowFocusChanged(hasFocus);
          LinearLayout AlphebtesLinearLayout=(LinearLayout)findViewById(R.id.AlphebtesLinearLayout);
          int width=AlphebtesLinearLayout.getWidth();
          LinearLayout.LayoutParams para=new LinearLayout.LayoutParams(width/8,
                  width/8 /*LinearLayout.LayoutParams.FILL_PARENT)*/);
          //list.setLayoutParams(para);
          createList(width);
      }
    public void createList(int width){
          map= new HashMap&lt;String, String&gt;();
          map2= new HashMap&lt;String, String&gt;();
          //--------------------------------------------
                  final String[] Uirkeys = {"அ","ஆ","இ","ஈ","உ","ஊ","எ","ஏ","ஐ","ஒ","ஓ","ஔ","ஃ"};
                  final String[] Uirvalues = {"a","aa","e","ee","ou","ou.","ay","ay.","ai","o","o.","ow","aak"};
              //----------------------------------------------------- 
                  final String[] Uirkeys1={"க்","ங்","ச்","ஞ்","ட்","ண்","த்","ந்","ப்","ம்","ய்","ர்","ல்","வ்","ழ்",
                            "ள்","ற்","ன்"};
                  final String[] Uirvalues1 = {"ik","ing","each","inj","it","in","ith","ind","ip","im","ye","er","il","ev","ill",
                             "ill.","er.","inn"};
              //------------------------------------------------------            
                  final String[] Uirkeys2={"க","ங","ச","ஞ","ட","ண","த","ந","ப","ம","ய","ர","ல","வ","ழ",
                            "ள","ற","ன"}; 
                  final String[] Uirvalues2 = {"ka","na.","sa","gna","ta","naa","tha","nha","pa","ma","ya",
                             "ra","la","va","la..","la.","ra","na"};
             //-------------------------------------------------------
              for(int loop=0;loop&lt;15;loop++){ 
                  if(count==0){
                      SelectKey=Uirkeys;
                      SelectValue=Uirvalues;
                  }else if(count==1){
                      SelectKey=Uirkeys1;
                      SelectValue=Uirvalues1;
                  }else if(count==2){
                      SelectKey=Uirkeys2;
                      SelectValue=Uirvalues2;
                  }
  
  
                  for(int i=0;i&lt;SelectKey.length;i++){
                      map.put(SelectKey[i],SelectValue[i]);
                  }
                  for(int j=0;j&lt;SelectKey.length;j++){
                      map2.put(SelectValue[j],SelectKey[j]);
                  }
          LinearLayout.LayoutParams para=new LinearLayout.LayoutParams(width/8,
                  LinearLayout.LayoutParams.FILL_PARENT);
          //para.weight=1;
          Activity activity = TamilAlphabets.this;
          TamilLetters=new TextView(TamilAlphabets.this);
          AlphebtesLinearLayout=(LinearLayout)findViewById(R.id.AlphebtesLinearLayout);
          //AlphebtesLinearLayout.setBackgroundColor(Color.RED);
          list=new ListView(this);
          list.setLayoutParams(para);
          GradientDrawable gd=new GradientDrawable();
          gd.setStroke(4, Color.BLACK);
          list.setBackgroundDrawable(gd);
          ListAdapterTamil LstAdapter=new ListAdapterTamil(TamilAlphabets.this,map,map2,SelectKey,SelectValue,activity);
          String s=map.get("a");
          list.setAdapter(LstAdapter);
  
          AlphebtesLinearLayout.addView(list);
          TamilLetters.setText("aa");
          TamilLetters.setLayoutParams(para);
          //TamilLetters.setText(map.get(Uirvalues[0]));
          //AlphebtesLinearLayout.addView(TamilLetters);
          //count++;
          }   
      }
  }
  class ListAdapterTamil extends BaseAdapter{
      Context context;
  Map&lt;String,String&gt; map=new HashMap&lt;String, String&gt;();
  Map&lt;String,String&gt; map2=new HashMap&lt;String, String&gt;();
  private Activity activity;
  String[] key;
  String[] values;
      public  ListAdapterTamil(Context context,Map&lt;String,String&gt; map,Map&lt;String,String&gt; map2,String[] key,String[] values,Activity activity){
          this.context=context;
          this.map=map;
          this.map2=map2;
          this.key=key;
          this.values=values;
          this.activity=activity;
      }
      @Override
  
      public int getCount() {
          // TODO Auto-generated method stub
          return key.length;
      }
  
      @Override
      public Object getItem(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
      @Override
      public long getItemId(int position) {
          // TODO Auto-generated method stub
          return position;
      }
  
      @Override
      public View getView(int position, View convertView, ViewGroup parent) {
          LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
              View rowView = inflater.inflate(R.layout.tamil_alphabets, parent, false);
          TextView txt=new TextView(activity);
          LinearLayout AlphebtesLinearLayout=(LinearLayout)rowView.findViewById(R.id.AlphebtesLinearLayout);
          AlphebtesLinearLayout.addView(txt);
          //txt.setText("ddd");
              //txt.setText(entry.getKey());
              txt.setText(map2.get(values[position]));
              txt.setPadding( 0, 0,0,50);
          return rowView;
      }
  
  }
  </code></pre>