我ContentProvider使用以下行为我创建了一个表 :
static final String CREATE_DB_TABLE =
" CREATE TABLE " + CONTACTS_TABLE_NAME +
" (_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
" pid TEXT NOT NULL, " +
" name TEXT NOT NULL,"+
"number TEXT NOT NULL);";
Run Code Online (Sandbox Code Playgroud)
它有4列.现在我想添加一个布尔值为true/false的列.如果我必须添加一个名为"status"的布尔列,我如何添加append/change这个语句.
我刚刚在android studio中导入了我的eclipse项目.它让我这么说
Error:SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Run Code Online (Sandbox Code Playgroud)
我看过一些编辑local.properties文件的教程,但它没有用.这是我的project.properties文件:
sdk.dir=E:\\Mod Eclipse\\adt-bundle-windows-x86_64-20130219\\sdk
Run Code Online (Sandbox Code Playgroud)
我的文件夹的实际目录是:
E:\ Mod Eclipse\adt-bundle-windows-x86_64-20130219\sdk
我有一个EditText,一个Button和一个TextView.单击该按钮时,textview显示以edittext编写的文本.是否可以根据文本找到占用的textview的大小.即如果它有三个字符" abc ",现在是什么宽度,如果它有5个字符,如" abcde ",那么宽度是多少?
我刚刚从eclipse导入了一个项目到Android工作室.几乎每一个图像,android studio都会出现以下错误.
Error:Must have one-pixel frame that is either transparent or white.
Run Code Online (Sandbox Code Playgroud)
我想在最近几个小时编辑我的图像,但是无法做到.任何人都可以指导我最好的解决方案.
为什么它只在Android Studio中为什么不在Eclipse中.
我有一个ContentProvider,它有两个表1. OnlineContacts2 AllContacts.然后我有一个方法,我查询两个表并分别得到他们的结果cursors.然后使用并列出一个列表加入他们.将此列表传递给我,我正在填充我的.喜欢 :CursorJoinerContactsCustomAdapter extending BaseAdapterlistview
public static List<Contact> getContacts(Context context){
List<Contact> contactList = new ArrayList<Contact>();
// Getting First Cursor
String URL = xyz;
Uri baseUri1 = Uri.parse(URL);
String[] select = xyz;
String where =xyz;
Cursor cursor = context.getContentResolver().query(baseUri1, select, where, null, "pid");
// Getting 2nd Cursor
Uri baseUri = xyz;
String[] projection =xyz;
String selection =xyz;
String[] selectionArgs = null;
String sortOrder = xyz;
Cursor mCursor= context.getContentResolver().query(baseUri, …Run Code Online (Sandbox Code Playgroud) 我有任何方法可以减少标题文本和TabLayoutGoogle plus中的图标之间的距离,其中图标和文本标题至少没有距离.我已经搜索过,但到目前为止还是找不到.
EDITED
这就是我设置图标和标题的方式:
tabLayout.getTabAt(3).setIcon(R.drawable.ic_more_horiz_white_24dp);
tabLayout.getTabAt(3).setText("More");
Run Code Online (Sandbox Code Playgroud)
这是我的TabLayout:
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tabIndicatorColor="@color/white"
app:tabIndicatorHeight="2dp"
app:tabTextAppearance="?android:attr/textAppearanceSmall"
/>
Run Code Online (Sandbox Code Playgroud) Fragment从a调用a Activity,我显示ListView两个Buttons.当我点击一个menu_item(即显示在线),我正在更新数据,所以ListView.现在我需要反映更新的数据.如何Fragment点击"在线显示" 后刷新.直到现在,我使用了以下代码:
Intent intent = getIntent();
Intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
finish();
startActivity(intent);
Run Code Online (Sandbox Code Playgroud)
但这将重启整体Activity.我只需要刷新电流Fragment.

编辑:代码已添加
活动类
public class ContactListActivity extends ActionBarActivity {
ListView listView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
final ActionBar actionBar = getActionBar();
MenuButtonUtil.enableMenuButton(this);
FragmentManager fragmentManager = getFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
MyContactsFragment contactListFragment = new MyContactsFragment ();
fragmentTransaction.replace(android.R.id.content, contactListFragment);
fragmentTransaction.commit();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds …Run Code Online (Sandbox Code Playgroud) 我需要设置所有这三个项目可见
1. ActionBar
2. ListView
3. EditText(在底部)
当我点击时EditText,它推动背景图像并挤压它.我看到一些教程和使用android:windowSoftInputMode="adjustPan",解决了挤压问题,但创建了一个新的.当它SoftKeyboard出现时,它也隐藏了ActionBar.我访问过很多问题,但其中没有一个问题确实有用.有没有办法设置ActionBar 始终可见屏幕上发生的任何事情......
EDITED
该xml片段的用于显示ListView和EditText是:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ListView
android:id="@id/android:list"
style="@style/ContactListView"
android:layout_width="match_parent"
android:layout_height="389dp"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:isScrollContainer="false" />
<TextView
android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="80dp"
android:layout_above="@+id/editText1"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:fontFamily="sans-serif-light"
android:gravity="center"
android:text="@string/no_contacts"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/editText1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:background="@android:color/holo_blue_dark"
android:ems="10"
android:imeOptions="flagNoExtractUi"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
编辑(第二)
快照是:

我有一个ListView具有fastScroll始终处于启用状态和SwipeRefresh执行.当我向下滑动列表时,它会刷新列表.我的问题是fastScroll.如果列表的第一个项目可见或在其最初的顶部显示,那么如果向下滚动fastScrollThumb,它会产生Swipe效果而不是向下滚动.无论如何/解决方案,如果我按fastScrollThumb,然后它不应该做Swipe刷新效果,而是它应该向下滚动,因为它的自然行为.

编辑
我XML Layout的如下:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swipe_container"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white" >
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/buttons_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="10dp">
<ImageView
android:id="@+id/SubmitButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/neoo_tab_selector" />
</RelativeLayout>
<ListView
android:id="@id/android:list"
style="@style/NeeoContactListView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/buttons_layout"
android:layout_marginTop="10dp" />
</RelativeLayout>
</android.support.v4.widget.SwipeRefreshLayout>
Run Code Online (Sandbox Code Playgroud)
我Logic for onScroll启用/禁用的SwipeRefresh是:
getListView().setOnScrollListener(new OnScrollListener() {
@Override
public void onScrollStateChanged(AbsListView view, int scrollState) {
}
@Override
public …Run Code Online (Sandbox Code Playgroud) 我知道如何打开软键盘甚至处理其关键事件.我需要打开数字键盘.
PS我没有在布局文件中使用Edittexts.
这是我用来以编程方式打开键盘的代码
if (PasscodeLockUpdated.this != null) {
PasscodeLockUpdated.this .getWindow()
.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);}
Run Code Online (Sandbox Code Playgroud) android numeric-keypad android-softkeyboard programmatically-created