我fragmentPagerAdapter viewpager里面有几个片段类.因此,这viewpager可以通过滑动水平向左和向右滚动.问题是,在每个页面上,我的值超出了页面大小,我需要垂直滚动才能看到它们.但我无法启用任何垂直滚动.我删除了所有scrollview的东西,让我的代码进入工作状态.(我想要像Android应用程序商店那样:水平滚动分类,垂直滚动查看应用程序.)
这是我的代码:
MyFragmentPagerAdapter:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<android.support.v4.view.ViewPager
android:id="@+id/pager"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:isScrollContainer="true">
<android.support.v4.view.PagerTitleStrip
android:id="@+id/pager_title_strip"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:background="#33b5e5"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:textColor="#fff" />
</android.support.v4.view.ViewPager>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
需要垂直滚动的片段活动:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="30dp"
android:layout_marginTop="10dp"
android:text="Last fill-up spent :"
android:textSize="15dp" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignLeft="@+id/textView1"
android:layout_below="@+id/textView1"
android:layout_marginTop="15dp"
android:text="Month total spent :"
android:textSize="15dp" />
<TextView
android:id="@+id/currentMoneySpentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/textView2"
android:layout_marginLeft="24dp"
android:layout_toRightOf="@+id/textView1"
android:textSize="15dp" />
<TextView
android:id="@+id/monthTotalSpentText"
android:layout_width="wrap_content"
android:layout_height="wrap_content" …Run Code Online (Sandbox Code Playgroud) 我是Android新手.我想点击发送按钮后发送短信
Run Code Online (Sandbox Code Playgroud)package com.example.smsproject; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.telephony.SmsManager; import android.view.View;`enter code here` import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class Page2Activity extends Activity { Button button; EditText textPhoneNo; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button) findViewById(R.id.button1); textPhoneNo = (EditText) findViewById(R.id.mobilenumber); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v){ //String phoneNo = textPhoneNo.getText().toString(); String phoneNo = "tel:xxxxxxxxxx"; String messageText = "SMS FROM ANDROID"; try { SmsManager smsManager = SmsManager.getDefault(); smsManager.sendTextMessage(phoneNo, null, …
我试图从列表中添加一些值到android sqlite数据库但不知何故它似乎找不到表,而且我尝试在表中添加的东西根据logcat的顺序不正确.我再使用了3个表,并将值添加到那些没有问题的表中.我一直在努力奋斗,但我似乎无法看到问题.有任何想法吗?这是我的代码和错误消息:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
currentCurrency = new ArrayList<String>();
currentCurrencyDetails = new ArrayList<String>();
currentCurrency.add("€");
currentCurrencyDetails.add("€ EURO");
currentCurrency.add("£");
currentCurrencyDetails.add("£ UK POUND");
currentCurrency.add("$");
currentCurrencyDetails.add("$ USA DOLLAR");
currentCurrency.add("¥");
currentCurrencyDetails.add("¥ JAPAN YEN");
db = new DBAdapter(this);
db.open();
for (int i = 0; i <= currentCurrency.size() - 1; i++) {
if (i == 0) {
db.insertDefaultCurrency(currentCurrency.get(i).toString(),
currentCurrencyDetails.get(i).toString(), 1);
} else {
db.insertDefaultCurrency(currentCurrency.get(i).toString(),
currentCurrencyDetails.get(i).toString(), 0);
}
}
}
Run Code Online (Sandbox Code Playgroud)
DBAdapter类:
public static final String MY_CURRENT_CURRENCY_TABLE = "MyCurrency";
public static final String MY_CURRENT_CURRENCY = …Run Code Online (Sandbox Code Playgroud)