2012-09-06 42 views
1

我有一個使用ActionBar選項卡的FragmentActivity,其中一個選項卡具有包含一系列圖表的選項卡主機。Teechart在第一次加載時顯示壓縮,因爲展開後的鍵盤縮小了視圖

此活動以搜索開始,因此當活動加載時鍵盤消失,這會導致第一個選項卡的圖表顯示爲壓縮。這隻發生在活動的第一次加載時。在我第二次搜索時,圖表全部顯示。

的的TabHost活動看起來是這樣的,

[Activity] 
public class MonthlySalesChartView : Activity 
{ 
    private CustomerRepository _customerRespository; 
    private BaseChart _chart; 
    private string _code; 

    protected override void OnCreate(Bundle savedInstanceState) 
    { 
     base.OnCreate(savedInstanceState); 
     _customerRespository = new CustomerRepository(); 

     _chart = BuildChart(); 

     _code = Intent.GetStringExtra("customer_code"); 

     SetContentView(_chart); 
    } 

    private BaseChart BuildChart() 
    { 
     var data = _customerRespository.GetMonthlySalesData(_code); 
     var tChart = new BaseChart(ApplicationContext, "Monthly Sales History"); 
     tChart.Axes.Left.Title.Text = "Spend ($)"; 
     tChart.Aspect.View3D = false; 
     var bar1 = new BaseBar(tChart.Chart) { Title = "Customer Spend" }; 
     bar1.Marks.Visible = false; 
     var avgLine = new Line(tChart.Chart) { Title = "Average Spend", Dark3D = false, LinePen = { Width = 4 } }; 

     foreach (var month in data.ResultSet.MonthlySales) 
     { 
      bar1.Add(month.Value, month.MonthName); 
     } 

     avgLine.DataSource = bar1; 
     avgLine.Function = new Average(true); 
     avgLine.Depth = 50; 

     return tChart; 
    } 
} 

什麼是一個例子看起來像

Chart

回答

1

嘗試在你的AndroidManifest.xml調整

設置的輸入模式關於活動。

android:windowSoftInputMode="stateVisible|adjustPan" 

這調整了系統如何調整屏幕以適應鍵盤佔用屏幕的空間。

相關問題