2014-10-01 5 views
0

나는 서면으로 LinearlayoutTextviewScrollView에 추가하고 있습니다. 내 ScrollView은 높이까지 스크롤 할 수 없습니다.ScrollView의 스크롤 높이가 작동하지 않습니다.

enter image description here

내 programicall 번호 :

if (cursor.moveToFirst()) { 
     do { 
      String last_ID = cursor.getString(cursor.getColumnIndex("lastId")); 
      String smsBody = cursor.getString(cursor.getColumnIndex("smsBody")); 
      String senderName = cursor.getString(cursor.getColumnIndex("senderName")); 
      String date[] = cursor.getString(cursor.getColumnIndex("receiveDate")).split("/"); 
      CalendarTool ct = 
        new CalendarTool(
          Integer.valueOf(date[0]), 
          Integer.valueOf(date[1]), 
          Integer.valueOf(date[2]) 
        ); 

      String IranianDate = ct.getIranianDate(); 

      ScrollView SV =new ScrollView(this); 

      LinearLayout ll = new LinearLayout(this); 
      ll.setBackgroundColor(Color.parseColor("#f7cbad")); 
      ll.setOrientation(LinearLayout.VERTICAL); 

      LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
        LinearLayout.LayoutParams.FILL_PARENT, 
        LinearLayout.LayoutParams.WRAP_CONTENT 
      ); 
      params.setMargins(0, 0, 0, 10); 
      ll.setLayoutParams(params); 



      TextView TV_IranianDate = new TextView(this); 
      TV_IranianDate.setText(IranianDate); 
      TV_IranianDate.setTextColor(Color.parseColor("#ffffff")); 
      TV_IranianDate.setLayoutParams(
        new ViewGroup.LayoutParams 
          (ViewGroup.LayoutParams.FILL_PARENT, 
            ViewGroup.LayoutParams.WRAP_CONTENT) 
      ); 
      ll.addView(TV_IranianDate); 

      TextView TV_smsBody = new TextView(this); 
      TV_smsBody.setText(smsBody); 
      TV_smsBody.setGravity(Gravity.RIGHT); 
      TV_smsBody.setLayoutParams(
        new ViewGroup.LayoutParams 
          (ViewGroup.LayoutParams.FILL_PARENT, 
            ViewGroup.LayoutParams.WRAP_CONTENT) 
      ); 
      TV_smsBody.setPadding(5, 5, 5, 5); 

      ll.addView(TV_smsBody); 

      TextView TV_spacer2 = new TextView(this); 
      TV_spacer2.setBackgroundColor(Color.parseColor("#000000")); 
      TV_spacer2.setLayoutParams(
        new ViewGroup.LayoutParams 
          (ViewGroup.LayoutParams.FILL_PARENT, 
            1) 
      ); 

      ll.addView(TV_spacer2); 

      SV.addView(ll); 



      ((LinearLayout) linearLayout).addView(SV); 

     } while (cursor.moveToNext()); 
    } 
+0

정확하게 스크롤 높이를 사용할 수 없습니까? 당신은 위 아래로 의미합니까? – Opiatefuchs

+0

@Opiatefuchs 예 thats right –

답변

0

나는 문제가있는 ScrollView 개체 것 같다. 당신은 예를 들어 다음과 같이 대신 HorizontalScrollView를 사용한다 : API를 설명 같은

HorizontalScrollView SV = new HorizontalScrollView(this); 

SV.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.MATCH_PARENT)); 

:

  • 있는 ScrollView는 수직 스크롤을 지원합니다. 가로 스크롤의 경우 HorizontalScrollView를 사용하십시오.
관련 문제