Search Results

Search found 11461 results on 459 pages for 'android'.

Page 4/459 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Linear Layout over relative layout

    - by Sai
    I have a relative layout for Camera preview with some overlay features. The layout file looks like the one in shown below: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" > <android.view.SurfaceView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/preview" android:layout_width="fill_parent" android:layout_height="fill_parent" > </android.view.SurfaceView> </RelativeLayout> I integrated some menu options from the android bluetooth chat example. The menu options work fine but if I click on one of the options, the app just froze. It opens a debug perspective but I am not able to understand them. The app does not seem to crash but it just froze. The layout that I am using for the menu options is: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" > <TextView android:id="@+id/title_paired_devices" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/title_paired_devices" android:visibility="gone" android:textColor="#fff" android:paddingLeft="5dp" /> <ListView android:id="@+id/paired_devices" android:layout_width="match_parent" android:layout_height="wrap_content" android:stackFromBottom="true" android:layout_weight="1" /> <TextView android:id="@+id/title_new_devices" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/title_other_devices" android:visibility="gone" android:textColor="#fff" android:paddingLeft="5dp" /> <ListView android:id="@+id/new_devices" android:layout_width="match_parent" android:layout_height="wrap_content" android:stackFromBottom="true" android:layout_weight="2" /> Can I attribute this to the fact that I am trying to overlay Linear layout over relative layout? Any suggestions to display the list of bluetooth devices over camera preview would be greatly appreciated

    Read the article

  • Android ViewPager Displaying TextView in Layout

    - by Ammonious
    I'm having a problem getting my viewpager to work correctly. Currently the bottom part of my layout will page across but the remaining part will not Here's my code that I have in my PageAdapter public class MyPageAdapter extends PagerAdapter { public int getCount() { return 31; } public Object instantiateItem(View collection, int position) { LayoutInflater inflater = (LayoutInflater) collection.getContext() .getSystemService(Context.LAYOUT_INFLATER_SERVICE); int resId = 0; switch (position) { case 0: resId = R.layout.main_menu; break; case 1: resId = R.layout.article1; break; case 2: resId = R.layout.article2; break; .... .... View view = inflater.inflate(resId, null); ((ViewPager) collection).addView(view, 0); return view; This is what I have for my XML <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="@drawable/background" android:clickable="true" android:id="@+id/layout13" android:weightSum="0"> <TextView android:id="@+id/textView01" android:layout_width="match_parent" android:layout_height="wrap_content" android:gravity="center_vertical|center_horizontal" android:padding="12dp" android:text="@string/article13" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#000000" /> <TextView android:id="@+id/textView02" android:layout_width="match_parent" android:layout_height="302dp" android:gravity="center_vertical|center_horizontal" android:text="@string/body13" android:textAppearance="?android:attr/textAppearanceLarge" android:textColor="#000000" /> <android.support.v4.view.ViewPager android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@id/viewPager" > </android.support.v4.view.ViewPager> </LinearLayout> I've tried Moving the around in my XML layout to right underneath my LinearLayout and i get the full screen but all my text disappears. It's probably something simple i'm missing but any help on this would be greatly appreciated!

    Read the article

  • Android ndk-build command does nothing

    - by James
    I have a similar question to that posted here: Android NDK: why ndk-build doesn't generate .so file and a new libs folder in Eclipse? ...though I am running Windows 7, not Mac os. Essentially the ndk-build command is run, gives no error but doesn't create an .so file (also, since I'm on windows this should create a .dll and not an .so?). I tried running the command from the root, jni, src folders etc. but got the same result; cmd just returns to the prompter after a few seconds. I ran it again from the jni folder with NDK_LOG=1 parameter to see what was happening. Here is a portion of the transcript of the log results after running ndk-build in the jni folder (after it successfully identified the platform, etc.)... Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity/jni Android NDK: Looking for jni/Android.mk in /workspace/NdkFooActivity Android NDK: Found it ! Android NDK: Found project path: /workspace/NdkFooActivity Android NDK: Ouput path: /workspace/NdkFooActivity/obj Android NDK: Parsing /cygdrive/c/android-ndk-r8/build/core/default-application.mk Android NDK: Found APP_PLATFORM=android-15 in /workspace/NdkFooActivity/project.properties Android NDK: Application local targets unknown platform 'android-15' Android NDK: Switching to android-14 Android NDK: Using build script /workspace/NdkFooActivity/jni/Android.mk Android NDK: Application 'local' is not debuggable Android NDK: Selecting release optimization mode (app is not debuggable) Android NDK: Adding import directory: /cygdrive/c/android-ndk-r8/sources Android NDK: Building application 'local' for ABI 'armeabi' Android NDK: Using target toolchain 'arm-linux-androideabi-4.4.3' for 'armeabi' ABI Android NDK: Looking for imported module with tag 'cxx-stl/system' Android NDK: Probing /cygdrive/c/android-ndk-r8/sources/cxx-stl/system/Android.mk Android NDK: Found in /cygdrive/c/android-ndk-r8/sources/cxx-stl/system Android NDK: Cygwin dependency file conversion script: ...after which point it just runs the script mentioned in the last line, then terminates. Any ideas? Thanks!

    Read the article

  • Android Layout: Display as much ImageViews as possible without scrolling

    - by Toni4780
    I am working on an app which should display several same size images on the screen. But it should only display only so much images as possible without offering scrolling. E.g. On a "big" tablet it could display 10x10 Imageviews (screen is large, so there is much space for pictures) On a "big" phone there might be enough space to display 6x6 ImageViews, so it should only display a 6x6 array of images. On a small phone there is propably only space for 4x4 ImageViews, so it should only display this. How can I make this in Android? I know about "layout-large", ... but if i make a special fixed xml-layout for a "large" device, it would not fit all devices correct. E.g. a Galaxy Nexus is a "normal" device and so is a Nexus One, but there would be at least be space for one or two more imageview rows on a Galaxy Nexus than on a Nexus One. So do I have to measure in code somehow how big the resolution is and display some TableRows accordingly? Or is there a special way how I can manage this?

    Read the article

  • Android: NullPointerException error in getting data in database

    - by Gil Viernes Marcelo
    This what happens in the system. 1. Admin login this is in other activity but i will not post it coz it has nothing to do with this (no problem) 2. Register user in system (using database no problem) 3. Click add user button (where existing user who register must display its name in ListView) Problem: When I click adduser to see if the system registered the user, it force close. CurrentUser.java package com.example.istronggyminstructor; import java.util.ArrayList; import android.os.Bundle; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.view.Gravity; import android.view.LayoutInflater; import android.view.Menu; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewGroup.LayoutParams; import android.view.WindowManager; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.List; import java.util.Random; import com.example.istronggyminstructor.registeredUserList.Users; import android.content.ContentValues; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; public class CurrentUsers extends Activity { private Button register; private Button adduser; EditText getusertext, getpass, getweight, textdisp; View popupview, popupview2; public static ArrayList<String> ArrayofName = new ArrayList<String>(); protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_current_users); register = (Button) findViewById(R.id.regbut); adduser = (Button) findViewById(R.id.addbut); register.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { LayoutInflater inflator = (LayoutInflater) getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); popupview = inflator.inflate(R.layout.popup, null); final PopupWindow popupWindow = new PopupWindow(popupview, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); popupWindow.showAtLocation(popupview, Gravity.CENTER, 0, 0); popupWindow.setFocusable(true); popupWindow.update(); Button dismissbtn = (Button) popupview.findViewById(R.id.close); dismissbtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { popupWindow.dismiss(); } }); popupWindow.showAsDropDown(register, 50, -30); } }); //Thread.setDefaultUncaughtExceptionHandler(new forceclose(this)); } public void registerUser(View v) { EditText username = (EditText) popupview.findViewById(R.id.usertext); EditText password = (EditText) popupview .findViewById(R.id.passwordtext); EditText weight = (EditText) popupview.findViewById(R.id.weight); String getUsername = username.getText().toString(); String getPassword = password.getText().toString(); String getWeight = weight.getText().toString(); dataHandler dbHandler = new dataHandler(this, null, null, 1); Users user = new Users(getUsername, getPassword, Integer.parseInt(getWeight)); dbHandler.addUsers(user); Toast.makeText(getApplicationContext(), "Registering...", Toast.LENGTH_SHORT).show(); } public void onClick_addUser(View v) { LayoutInflater inflator = (LayoutInflater) getBaseContext() .getSystemService(LAYOUT_INFLATER_SERVICE); popupview2 = inflator.inflate(R.layout.popup2, null); final PopupWindow popupWindow = new PopupWindow(popupview2, LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); popupWindow.showAtLocation(popupview2, Gravity.CENTER, 0, -10); popupWindow.setFocusable(true); popupWindow.update(); Button dismissbtn = (Button) popupview2.findViewById(R.id.close2); dismissbtn.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { popupWindow.dismiss(); } }); popupWindow.showAsDropDown(register, 50, -30); dataHandler dbHandler = new dataHandler(this, null, null, 1); dbHandler.getAllUsers(); ListView list = (ListView)findViewById(R.layout.popup2); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, ArrayofName); list.setAdapter(adapter); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.current_users, menu); return true; } } registeredUserList.java package com.example.istronggyminstructor; public class registeredUserList { public static class Users { private static int _id; private static String _users; private static String _password; private static int _weight; private static String[] _workoutlists; private static int _score; public Users() { } public Users(String username, String password, int weight) { _users = username; _password = password; _weight = weight; } public int getId() { return _id; } public static void setId(int id) { _id = id; } public String getUsers() { return _users; } public static void setUsers(String users) { _users = users; } public String getPassword(){ return _password; } public void setPassword(String password){ _password = password; } public int getWeight(){ return _weight; } public static void setWeight(int weight){ _weight = weight; } public String[] getWorkoutLists(){ return _workoutlists; } public void setWorkoutLists(String[] workoutlists){ _workoutlists = workoutlists; } public int score(){ return _score; } public void score(int score){ _score = score; } } } dataHandler.java package com.example.istronggyminstructor; import java.util.ArrayList; import java.util.List; import com.example.istronggyminstructor.registeredUserList.Users; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteDatabase.CursorFactory; import android.database.sqlite.SQLiteOpenHelper; public class dataHandler extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; private static final String DATABASE_NAME = "userInfo.db"; public static final String TABLE_USERINFO = "user"; public static final String COLUMN_ID = "_id"; public static final String COLUMN_USERNAME = "username"; public static final String COLUMN_PASSWORD = "password"; public static final String COLUMN_WEIGHT = "weight"; public dataHandler(Context context, String name, CursorFactory factory, int version) { super(context, DATABASE_NAME, factory, DATABASE_VERSION); } @Override public void onCreate(SQLiteDatabase db) { String CREATE_USER_TABLE = "CREATE TABLE " + TABLE_USERINFO + " (" + COLUMN_ID + " INTEGER PRIMARY KEY, " + COLUMN_USERNAME + " TEXT," + COLUMN_PASSWORD + " TEXT, " + COLUMN_WEIGHT + " INTEGER " + ");"; db.execSQL(CREATE_USER_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { db.execSQL("DROP TABLE IF EXISTS " + TABLE_USERINFO); onCreate(db); } public void addUsers(Users user) { ContentValues values = new ContentValues(); values.put(COLUMN_USERNAME, user.getUsers()); values.put(COLUMN_PASSWORD, user.getPassword()); values.put(COLUMN_WEIGHT, user.getWeight()); SQLiteDatabase db = this.getWritableDatabase(); db.insert(TABLE_USERINFO, null, values); db.close(); } public Users findUsers(String username) { String query = "Select * FROM " + TABLE_USERINFO + " WHERE " + COLUMN_USERNAME + " = \"" + username + "\""; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(query, null); Users user = new Users(); if (cursor.moveToFirst()) { cursor.moveToFirst(); Users.setUsers(cursor.getString(1)); //Users.setWeight(Integer.parseInt(cursor.getString(3))); not yet needed cursor.close(); } else { user = null; } db.close(); return user; } public List<Users> getAllUsers(){ List<Users> user = new ArrayList(); String selectQuery = "SELECT * FROM " + TABLE_USERINFO; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); if (cursor.moveToFirst()) { do { Users users = new Users(); users.setUsers(cursor.getString(1)); String name = cursor.getString(1); CurrentUsers.ArrayofName.add(name); // Adding contact to list user.add(users); } while (cursor.moveToNext()); } // return user list return user; } public boolean deleteUsers(String username) { boolean result = false; String query = "Select * FROM " + TABLE_USERINFO + " WHERE " + COLUMN_USERNAME + " = \"" + username + "\""; SQLiteDatabase db = this.getWritableDatabase(); Cursor cursor = db.rawQuery(query, null); Users user = new Users(); if (cursor.moveToFirst()) { Users.setId(Integer.parseInt(cursor.getString(0))); db.delete(TABLE_USERINFO, COLUMN_ID + " = ?", new String[] { String.valueOf(user.getId()) }); cursor.close(); result = true; } db.close(); return result; } } Logcat 08-20 03:23:23.293: E/AndroidRuntime(16363): FATAL EXCEPTION: main 08-20 03:23:23.293: E/AndroidRuntime(16363): java.lang.IllegalStateException: Could not execute method of the activity 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.view.View$1.onClick(View.java:3599) 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.view.View.performClick(View.java:4204) 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.view.View$PerformClick.run(View.java:17355) 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.os.Handler.handleCallback(Handler.java:725) 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.os.Handler.dispatchMessage(Handler.java:92) 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.os.Looper.loop(Looper.java:137) 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.app.ActivityThread.main(ActivityThread.java:5041) 08-20 03:23:23.293: E/AndroidRuntime(16363): at java.lang.reflect.Method.invokeNative(Native Method) 08-20 03:23:23.293: E/AndroidRuntime(16363): at java.lang.reflect.Method.invoke(Method.java:511) 08-20 03:23:23.293: E/AndroidRuntime(16363): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 08-20 03:23:23.293: E/AndroidRuntime(16363): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560) 08-20 03:23:23.293: E/AndroidRuntime(16363): at dalvik.system.NativeStart.main(Native Method) 08-20 03:23:23.293: E/AndroidRuntime(16363): Caused by: java.lang.reflect.InvocationTargetException 08-20 03:23:23.293: E/AndroidRuntime(16363): at java.lang.reflect.Method.invokeNative(Native Method) 08-20 03:23:23.293: E/AndroidRuntime(16363): at java.lang.reflect.Method.invoke(Method.java:511) 08-20 03:23:23.293: E/AndroidRuntime(16363): at android.view.View$1.onClick(View.java:3594) 08-20 03:23:23.293: E/AndroidRuntime(16363): ... 11 more 08-20 03:23:23.293: E/AndroidRuntime(16363): Caused by: java.lang.NullPointerException 08-20 03:23:23.293: E/AndroidRuntime(16363): at com.example.istronggyminstructor.CurrentUsers.onClick_addUser(CurrentUsers.java:118) 08-20 03:23:23.293: E/AndroidRuntime(16363): ... 14 more

    Read the article

  • Unable to resolve class in build.gradle using Android Studio 0.60/Gradle 0.11

    - by saywhatnow
    Established app working fine using Android Studio 0.5.9/ Gradle 0.9 but upgrading to Android Studio 0.6.0/ Gradle 0.11 causes the error below. Somehow Studio seems to have lost the ability to resolve the android tools import at the top of the build.gradle file. Anyone got any ideas on how to solve this? build file 'Users/[me]/Repositories/[project]/[module]/build.gradle': 1: unable to resolve class com.android.builder.DefaultManifestParser @ line 1, column 1. import com.android.builder.DefaultManifestParser 1 error at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302) at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:858) at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:548) at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:497) at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:306) at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:287) at org.gradle.groovy.scripts.internal.DefaultScriptCompilationHandler.compileScript(DefaultScriptCompilationHandler.java:115) ... 77 more 2014-06-09 10:15:28,537 [ 92905] INFO - .BaseProjectImportErrorHandler - Failed to import Gradle project at '/Users/[me]/Repositories/[project]' org.gradle.tooling.BuildException: Could not run build action using Gradle distribution 'http://services.gradle.org/distributions/gradle-1.12-all.zip'. at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:53) at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:57) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:64) [project]/[module]/build.gradle import com.android.builder.DefaultManifestParser apply plugin: 'android-sdk-manager' apply plugin: 'android' android { sourceSets { main { manifest.srcFile 'src/main/AndroidManifest.xml' res.srcDirs = ['src/main/res'] } debug { res.srcDirs = ['src/debug/res'] } release { res.srcDirs = ['src/release/res'] } } compileSdkVersion 19 buildToolsVersion '19.0.0' defaultConfig { minSdkVersion 14 targetSdkVersion 19 } signingConfigs { release } buildTypes { release { runProguard false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' signingConfig signingConfigs.release applicationVariants.all { variant -> def file = variant.outputFile def manifestParser = new DefaultManifestParser() def wmgVersionCode = manifestParser.getVersionCode(android.sourceSets.main.manifest.srcFile) println wmgVersionCode variant.outputFile = new File(file.parent, file.name.replace("-release.apk", "_" + wmgVersionCode + ".apk")) } } } packagingOptions { exclude 'META-INF/LICENSE.txt' exclude 'META-INF/NOTICE.txt' } } def Properties props = new Properties() def propFile = file('signing.properties') if (propFile.canRead()){ props.load(new FileInputStream(propFile)) if (props!=null && props.containsKey('STORE_FILE') && props.containsKey('STORE_PASSWORD') && props.containsKey('KEY_ALIAS') && props.containsKey('KEY_PASSWORD')) { println 'RELEASE BUILD SIGNING' android.signingConfigs.release.storeFile = file(props['STORE_FILE']) android.signingConfigs.release.storePassword = props['STORE_PASSWORD'] android.signingConfigs.release.keyAlias = props['KEY_ALIAS'] android.signingConfigs.release.keyPassword = props['KEY_PASSWORD'] } else { println 'RELEASE BUILD NOT FOUND SIGNING PROPERTIES' android.buildTypes.release.signingConfig = null } }else { println 'RELEASE BUILD NOT FOUND SIGNING FILE' android.buildTypes.release.signingConfig = null } repositories { maven { url 'https://repo.commonsware.com.s3.amazonaws.com' } maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' } } dependencies { compile 'com.github.gabrielemariotti.changeloglib:library:1.4.+' compile 'com.google.code.gson:gson:2.2.4' compile 'com.google.android.gms:play-services:+' compile 'com.android.support:appcompat-v7:+' compile 'com.squareup.okhttp:okhttp:1.5.+' compile 'com.octo.android.robospice:robospice:1.4.11' compile 'com.octo.android.robospice:robospice-cache:1.4.11' compile 'com.octo.android.robospice:robospice-retrofit:1.4.11' compile 'com.commonsware.cwac:security:0.1.+' compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+' compile 'com.android.support:support-v4:19.+' compile 'uk.co.androidalliance:edgeeffectoverride:1.0.1+' compile 'de.greenrobot:eventbus:2.2.1+' compile project(':captureActivity') compile ('de.keyboardsurfer.android.widget:crouton:1.8.+') { exclude group: 'com.google.android', module: 'support-v4' } compile files('libs/CWAC-LoaderEx.jar') }

    Read the article

  • Fragment not showing up and breaks other buttons on Layout

    - by Devin Crane
    I'm learning how to use Fragments, and trying to add a fragment tag_button.xml at runtime to a FrameLayout tagFragmentContainer deep within another layout, deepLayout.xml. I get no errors, but the fragment doesn't show up. When I make its container visible, I can see a small sliver of layout between the other elements already existing, but then it disappears after onCreateView(), and all the remaining buttons are broken, which is even more confusing to me. tag_button.xml is just a regular layout file with some text and a button. tagFragmentContainer, within a LinearLayout in the middle of a large layout file, deepLayout.xml: <LinearLayout android:id="@+id/tagButtonsLayout" android:layout_marginBottom="10dip" android:visibility="gone" style="@style/Form"> <FrameLayout android:id="@+id/tagFragmentContainer" android:layout_marginBottom="10dip" style="@style/Form"> </FrameLayout> </LinearLayout> In deepLayoutActivity, I make visible tagButtonsLayout and start TagButtonActivity: final LinearLayout anotherlm = (LinearLayout) findViewById(R.id.tagButtonsLayout); anotherlm.setVisibility(View.VISIBLE); Intent i = new Intent (this, TagButtonActivity.class); startActivity(i); TagButtonActivity is as follows: public class TagButtonActivity extends FragmentActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.action_expense); if (savedInstanceState != null) return; TagButtonFragment firstFragment = new TagButtonFragment(); getSupportFragmentManager().beginTransaction().add(R.id.tagFragmentContainer, firstFragment, "tagOne").commit(); } } TagButtonFragment: public class TagButtonFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.tag_button, container, false); } } tag_button.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" style="@style/Form"> <TextView android:id="@+id/tag_button_header" style="@style/FieldHeader" android:text="example text"/> <RelativeLayout android:id="@+id/tag_button_block" android:layout_width="match_parent" android:layout_marginLeft="2dip" android:layout_marginTop="3dip" android:layout_marginBottom="3dip" android:layout_marginRight="2dip" android:layout_height="43dip" android:clickable="true" android:background="@drawable/row_spinner_selector"> <ImageView android:id="@+id/question_arrow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="10dip" android:layout_marginRight="10dip" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@drawable/arrow_right"/> <TextView android:id="@+id/tag_question_text" android:layout_toLeftOf="@id/question_arrow" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="10dip" android:layout_centerVertical="true" android:textColor="@android:color/black" android:singleLine="true" android:ellipsize="end" android:textSize="15sp" android:text="@string/not_selected"/> </RelativeLayout> </LinearLayout> I would certainly appreciate any help in figuring this out from someone who knows fragments better than me! Thanks!

    Read the article

  • Android app crashes when I change the default xml layout file to another

    - by mib1413456
    I am currently just starting to learn android development and have created a basic "Hello world" app that uses "activity_main.xml" for the default layout. I tried to create a new layout xml file called "new_layout.xml" with a text view, a text field and a button and did the following changes in the MainActivity.java file: setContentView(R.layout.new_layout); I did nothing else expect for adding a new_layout.xml in the res/layout folder, I have tried restarting and cleaning the project but nothing. Below is my activity_main.xml file, new_layout.xml file and MainActivity.java activity_main.xml: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="org.example.androidsdk.demo.MainActivity" tools:ignore="MergeRootFrame" /> new_layout.xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="horizontal" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" /> <EditText android:id="@+id/editText1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:ems="10" > <requestFocus /> </EditText> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /> MainActivity.java file package org.example.androidsdk.demo; import android.app.Activity; import android.app.ActionBar; import android.app.Fragment; import android.os.Bundle; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.os.Build; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.new_layout); if (savedInstanceState == null) { getFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()) .commit(); } } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } /** * A placeholder fragment containing a simple view. */ public static class PlaceholderFragment extends Fragment { public PlaceholderFragment() { } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View rootView = inflater.inflate(R.layout.fragment_main, container, false); return rootView; } } }

    Read the article

  • ScrollView in android

    - by rantravee
    hi, I' have a view that contains several textViews an ImageView and a Button . Because on small screen devices (or in landscape mode on big ones ) not all are visible I use a Scroll as the parent of the whole hierarchy to allow the user to view all the information. The things are suck that the button must be at the buttom of the view . However on big screen device , where it remains enough space at the buttom , the button is put immediatelly below the last textview,and seems to occupy all the remaining space (resulting in an unnactractive view) . Trying to use android:allignParentButtom ="true" not only that it has no effect but it puts the button at top of the screen . Has anyone any ideea how could I accomplish what I described ? here's the xml <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/scroll_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true"> <RelativeLayout android:id="@+id/gps_info_page1" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerHorizontal="true"> <TextView android:id="@+id/itsDateTimeValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:text="@string/eStrUnknown"> </TextView> <RelativeLayout android:id="@+id/directions" android:layout_centerHorizontal="true" android:layout_below="@+id/itsDateTimeValue" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:id="@+id/itsDirectionValue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0" android:layout_marginRight="2dip" android:textSize="20sp"> </TextView> <TextView android:id="@+id/itsOrientation" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20sp" android:layout_marginLeft="2dip" android:text="@string/eStrUnknown" android:layout_toRightOf="@+id/itsDirectionValue"> </TextView> </RelativeLayout> <ImageView android:id="@+id/itsImage" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/compass" android:layout_below="@+id/directions" android:layout_centerHorizontal="true"> </ImageView> <RelativeLayout> ..."TextViews below the above image" </RelativeLayout> <RelativeLayout> ..."TextViews below the above" </RelativeLayout> <RelativeLayout> ..."TextViews below the above" </RelativeLayout> <RelativeLayout> ..."TextViews below the above" </RelativeLayout> <RelativeLayout ..."TextViews below the above" </RelativeLayout> <LinearLayout android:id="@+id/div" android:layout_width="fill_parent" android:layout_height="1dip" android:layout_below="@+id/sunset_layout" android:background="#F333"> </LinearLayout> <Button //adding here android:alignParentBottom="true" has described above behavior android:layout_marginBottom="3dip" android:layout_marginTop="20dip" android:id="@+id/done_button" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/eStrDone" android:textSize="18sp" android:layout_below="@+id/div" android:layout_centerHorizontal="true"> </Button> </RelativeLayout> </ScrollView>

    Read the article

  • Please verify my layout: bottom button keeps coming up over keyboard

    - by steff
    Hi everyone, I have a layout which does almost what I want. There's just one bug regarding the button at the bottom. I should stay at the bottom at all times. But whenever I bring up the soft-keyboard the button will be displayed above the keyboard. This is not what I want but it should become covered by the keyboard. Moreover, I'd be happy if you could comment on how the layout's built. Thanks, steff <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <LinearLayout android:id="@+id/l_layout_tags" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <TextView android:text="TAGS:" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <AutoCompleteTextView android:id="@+id/actv_tags" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="1" android:imeOptions="actionDone" /> <ImageButton android:id="@+id/btn_add_tag" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_input_add" android:onClick="addTag"/> </LinearLayout> <ScrollView android:id="@+id/sv_scroll_contents" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@id/l_layout_tags" android:scrollbarFadeDuration="2000" > <TableLayout android:id="@+id/t_layout_contents" android:layout_width="fill_parent" android:layout_height="wrap_content" android:stretchColumns="1" android:paddingRight="5dip"> <TableRow android:id="@+id/tr_template"> <ImageView android:id="@+id/iv_blank" android:src="@android:color/transparent" /> <EditText android:id="@+id/et_content1" android:gravity="top" android:maxWidth="200dp" android:imeOptions="actionDone" /> </TableRow> </TableLayout> </ScrollView> <LinearLayout android:id="@+id/l_layout_media_btns" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_centerHorizontal="true" android:layout_below="@id/sv_scroll_contents" > <ImageButton android:id="@+id/btn_camera" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_camera" android:onClick="takePicture" /> <ImageButton android:id="@+id/btn_video" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_camera" /> <ImageButton android:id="@+id/btn_audio" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_btn_speak_now" /> <ImageButton android:id="@+id/btn_sketch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@android:drawable/ic_menu_edit" /> </LinearLayout> <ImageButton android:id="@+id/btn_save_note" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:src="@android:drawable/ic_menu_upload" /> </RelativeLayout>

    Read the article

  • Listview Row Overlap Problem

    - by rgrandy
    I just updated my app and I am getting some odd complaints from people who update it. I am only getting complaints from people with non-stock android phones (phones that manufacturers have modified...HTC phones, cliq, pulse, etc), other phones like the Droid, Nexus work fine. My app (Photo Frame Deluxe) has a list in it with a Image View, Text View, View (spacer) and checkbox, all in a row. What happens on the affected phones is that the rows start overlapping and it cuts the top half of everything off. My layout code for this is below, I am pulling my hair out on this, what might I have wrong in this layout. Why does this work on some phones and not on others? Any help would be appreciated. Row Layout: <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal"> <ImageView android:id="@+id/photorowIcon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:paddingTop="10dp" android:paddingBottom="10dp" android:paddingRight="5dp" /> <TextView android:id="@+id/photorowText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" /> <View android:layout_width="0px" android:layout_height="wrap_content" android:layout_weight="1"/> <CheckBox android:id="@+id/photorowCheckBox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:focusable="false" android:focusableInTouchMode="false" /> </LinearLayout> Layout Row is inserted in: <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/title1_gradient" android:orientation="vertical"> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Select Photos to Display:" android:textSize="20sp" android:textStyle="bold" android:textColor="#FFFFFFFF" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingTop="5dp" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/folderName" android:textSize="15sp" android:textStyle="bold" android:textColor="#FFFFFFFF" android:paddingLeft="5dp" android:paddingRight="5dp" android:paddingBottom="5dp" /> <View android:layout_width="fill_parent" android:layout_height="1px" android:background="#406C6C6C"/> </LinearLayout> <ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="0px" android:layout_weight="1" android:drawSelectorOnTop="false" android:paddingLeft="5dp" android:paddingRight="5dp" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="bottom"> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_gravity="bottom" android:background="#FF6C6C6C" android:padding="5dp"> <Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:id="@+id/ok" android:text="OK"/> </LinearLayout> </LinearLayout> </LinearLayout>

    Read the article

  • Why are some of my view not aligned correctly at the bottom of my relative layout?

    - by Janusz
    I have problems getting some of my views aligned in a relative layout that I use inside a row of my listview. Here is a screenshot from the layout builder in Eclipse, this is what I think it should look like: The next image is from the emulator. Now the TestTestTest View is at the top and covers the name and distance Textviews. This is my layout: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="4dip"> <ImageView android:id="@+id/logo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:scaleType="centerInside" android:src="@drawable/icon" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:background="@color/green" /> <TextView android:id="@+id/distance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Distance" android:layout_alignParentRight="true" android:layout_alignParentTop="true" android:paddingRight="4dip" android:background="#000000" /> <TextView android:id="@+id/name" android:layout_width="fill_parent" style="@style/ListHeadText" android:layout_height="wrap_content" android:text="Name" android:layout_alignTop="@id/distance" android:layout_toRightOf="@id/logo" android:layout_toLeftOf="@id/distance" android:gravity="clip_horizontal" android:lines="1" android:paddingLeft="4dip" android:background="@color/red" /> <TextView android:id="@+id/number" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Number" android:paddingRight="4dip" android:layout_alignRight="@id/distance" android:background="@color/darkred" android:layout_below="@id/distance" /> <TextView android:id="@+id/subcategory" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Subcategory" android:paddingLeft="4dip" android:layout_alignLeft="@id/name" android:lines="1" android:gravity="clip_horizontal" android:layout_below="@id/distance" android:background="@color/green" /> <TextView android:id="@+id/test" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="TestTestTest" android:paddingLeft="4dip" android:layout_alignParentBottom="true" android:gravity="bottom" android:background="@color/red" /> Shouldnt align_parent_bottom put the view at the bottom of the cell in the list?

    Read the article

  • Gradle + Robolectric: Where do I put the file org.robolectric.Config.properties?

    - by Rob Hawkins
    I'm trying to setup a test using Robolectric to click on a menu button in this repository. Basic Robolectric tests will run, but I'm not able to run any project-specific test using resources because it says it can't find my AndroidManifest.xml. After running ../gradlew clean check, here's the standard output from the Robolectric html file: WARNING: No manifest file found at ./AndroidManifest.xml.Falling back to the Android OS resources only. To remove this warning, annotate your test class with @Config(manifest=Config.NONE). I found these instructions which indicate I should create an org.robolectric.Config.properties file, but I'm not sure where to put it. I've tried everywhere, pretty much, and despite moving the file, the path in the error message is always the same as above (./AndroidManifest.xml). This makes me think the build process has never picked up the settings in the file org.robolectric.Config.properties. I also tried the @Config(manifest="") directive but this gave me a cannot find symbol error. If I move the AndroidManifest.xml into my project directory, then I get an error about it not being able to find the path ./res/values and I wasn't able to resolve that either. Any ideas? Update 1 Thanks Eugen, I'm now using @RunWith(RobolectricGradleTestRunner.class) instead of @RunWith(RobolectricTestRunner). Now I get a different error, still occurring on the same line of my BasicTest.java KeywordList keywordList = Robolectric.buildActivity(KeywordList.class).create().get(); Below are results from the standard error, standard output, and "failed tests" tab in the Robolectric test report: Note: I also tried substituting in a jar built from the latest Robolectric updates, robolectric-2.2-SNAPSHOT.jar, but still got an error. Standard Error WARNING: no system properties value for ro.build.date.utc Standard Output DEBUG: Loading resources for net.frontlinesms.android from ~/workspace-studio/frontlinesms-for-android/FrontlineSMS/build/res/all/debug... DEBUG: Loading resources for android from jar:~/.m2/repository/org/robolectric/android-res/4.1.2_r1_rc/android-res-4.1.2_r1_rc-real.jar!/res... INFO: no id mapping found for android:drawable/scrollbar_handle_horizontal; assigning ID #0x1140002 INFO: no id mapping found for android:drawable/scrollbar_handle_vertical; assigning ID #0x1140003 INFO: no id mapping found for android:color/highlighted_text_dark; assigning ID #0x1140004 INFO: no id mapping found for android:color/hint_foreground_dark; assigning ID #0x1140005 INFO: no id mapping found for android:color/link_text_dark; assigning ID #0x1140006 INFO: no id mapping found for android:color/dim_foreground_dark_disabled; assigning ID #0x1140007 INFO: no id mapping found for android:color/dim_foreground_dark; assigning ID #0x1140008 INFO: no id mapping found for android:color/dim_foreground_dark_inverse_disabled; assigning ID #0x1140009 INFO: no id mapping found for android:color/dim_foreground_dark_inverse; assigning ID #0x114000a INFO: no id mapping found for android:color/bright_foreground_dark_inverse; assigning ID #0x114000b INFO: no id mapping found for android:layout/text_edit_paste_window; assigning ID #0x114000c INFO: no id mapping found for android:layout/text_edit_no_paste_window; assigning ID #0x114000d INFO: no id mapping found for android:layout/text_edit_side_paste_window; assigning ID #0x114000e INFO: no id mapping found for android:layout/text_edit_side_no_paste_window; assigning ID #0x114000f INFO: no id mapping found for android:layout/text_edit_suggestion_item; assigning ID #0x1140010 Failed Tests android.view.InflateException: XML file ~/workspace-studio/frontlinesms-for-android/FrontlineSMS/build/res/all/debug/layout/rule_list.xml line #-1 (sorry, not yet implemented): Error inflating class net.frontlinesms.android.ui.view.ActionBar at android.view.LayoutInflater.createView(LayoutInflater.java:613) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.performCreate(Activity.java:5008) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.remote.internal.hub.MessageHub$Handler.run(MessageHub.java:355) at org.gradle.internal.concurrent.DefaultExecutorFactory$StoppableExecutorImpl$1.run(DefaultExecutorFactory.java:66) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918) at java.lang.Thread.run(Thread.java:680) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createView(LayoutInflater.java:587) at android.view.LayoutInflater.createView(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:352) at android.view.LayoutInflater.inflate(LayoutInflater.java) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.robolectric.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:455) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.$$robo$$Activity_c57b_performCreate(Activity.java:5008) at android.app.Activity.performCreate(Activity.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 7 more Caused by: android.view.InflateException: XML file ~/workspace-studio/frontlinesms-for-android/FrontlineSMS/build/res/all/debug/layout/actionbar.xml line #-1 (sorry, not yet implemented): Error inflating class android.widget.ProgressBar at android.view.LayoutInflater.createView(LayoutInflater.java:613) at org.robolectric.shadows.RoboLayoutInflater.onCreateView(RoboLayoutInflater.java:38) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at net.frontlinesms.android.ui.view.ActionBar.<init>(ActionBar.java:65) at android.view.LayoutInflater.createView(LayoutInflater.java:587) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.performCreate(Activity.java:5008) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) ... 7 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createView(LayoutInflater.java:587) at android.view.LayoutInflater.createView(LayoutInflater.java) at org.robolectric.shadows.RoboLayoutInflater.onCreateView(RoboLayoutInflater.java:38) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_onCreateView(LayoutInflater.java:660) at android.view.LayoutInflater.onCreateView(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createViewFromTag(LayoutInflater.java:685) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java) at net.frontlinesms.android.ui.view.ActionBar.<init>(ActionBar.java:65) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createView(LayoutInflater.java:587) at android.view.LayoutInflater.createView(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java) at android.view.LayoutInflater.$$robo$$LayoutInflater_1d1f_inflate(LayoutInflater.java:352) at android.view.LayoutInflater.inflate(LayoutInflater.java) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) at org.robolectric.shadows.ShadowActivity.setContentView(ShadowActivity.java:272) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.robolectric.bytecode.ShadowWrangler$ShadowMethodPlan.run(ShadowWrangler.java:455) at android.app.Activity.setContentView(Activity.java) at net.frontlinesms.android.activity.KeywordList.onCreate(KeywordList.java:70) at android.app.Activity.$$robo$$Activity_c57b_performCreate(Activity.java:5008) at android.app.Activity.performCreate(Activity.java) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.util.ActivityController$1.run(ActivityController.java:119) at org.robolectric.shadows.ShadowLooper.runPaused(ShadowLooper.java:256) at org.robolectric.util.ActivityController.create(ActivityController.java:114) at org.robolectric.util.ActivityController.create(ActivityController.java:126) at net.frontlinesms.android.BasicTest.setUp(BasicTest.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24) at org.robolectric.RobolectricTestRunner$2.evaluate(RobolectricTestRunner.java:241) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.robolectric.RobolectricTestRunner$1.evaluate(RobolectricTestRunner.java:177) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.runTestClass(JUnitTestClassExecuter.java:80) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassExecuter.execute(JUnitTestClassExecuter.java:47) at org.gradle.api.internal.tasks.testing.junit.JUnitTestClassProcessor.processTestClass(JUnitTestClassProcessor.java:69) at org.gradle.api.internal.tasks.testing.SuiteTestClassProcessor.processTestClass(SuiteTestClassProcessor.java:49) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:35) at org.gradle.messaging.dispatch.ReflectionDispatch.dispatch(ReflectionDispatch.java:24) at org.gradle.messaging.dispatch.ContextClassLoaderDispatch.dispatch(ContextClassLoaderDispatch.java:32) at org.gradle.messaging.dispatch.ProxyDispatchAdapter$DispatchingInvocationHandler.invoke(ProxyDispatchAdapter.java:93) at com.sun.proxy.$Proxy2.processTestClass(Unknown Source) at org.gradle.api.internal.tasks.testing.worker.TestWorker.processTestClass(TestWorker.java:103) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) ... 7 more Caused by: java.lang.ClassCastException: org.robolectric.res.AttrData cannot be cast to org.robolectric.res.StyleData at org.robolectric.shadows.ShadowAssetManager$StyleResolver.getParent(ShadowAssetManager.java:353) at org.robolectric.shadows.ShadowAssetManager$StyleResolver.getAttrValue(ShadowAssetManager.java:336) at org.robolectric.shadows.ShadowResources.findAttributeValue(ShadowResources.java:259) at org.robolectric.shadows.ShadowResources.attrsToTypedArray(ShadowResources.java:188) at org.robolectric.shadows.ShadowResources.access$000(ShadowResources.java:51) at org.robolectric.shadows.ShadowResources$ShadowTheme.obtainStyledAttributes(ShadowResources.java:460) at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java) at android.content.Context.obtainStyledAttributes(Context.java:374) at android.view.View.__constructor__(View.java:3297) at org.fest.reflect.method.Invoker.invoke(Invoker.java:112) at org.robolectric.shadows.ShadowView.__constructor__(ShadowView.java:68) at android.view.View.<init>(View.java:3295) at android.widget.ProgressBar.<init>(ProgressBar.java:253) at android.widget.ProgressBar.<init>(ProgressBar.java:246) at android.widget.ProgressBar.<init>(ProgressBar.java:242) at android.view.LayoutInflater.createView(LayoutInflater.java:587) at org.robolectric.shadows.RoboLayoutInflater.onCreateView(RoboLayoutInflater.java:38) at android.view.LayoutInflater.onCreateView(LayoutInflater.java:660) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:685) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.rInflate(LayoutInflater.java:749) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at net.frontlinesms.android.ui.view.ActionBar.<init>(ActionBar.java:65) at android.view.LayoutInflater.createView(LayoutInflater.java:587) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) at android.view.LayoutInflater.rInflate(LayoutInflater.java:746) at android.view.LayoutInflater.inflate(LayoutInflater.java:489) at android.view.LayoutInflater.inflate(LayoutInflater.java:396) at android.view.LayoutInflater.inflate(LayoutInflater.java:352) at org.robolectric.tester.android.view.RoboWindow.setContentView(RoboWindow.java:82) [truncated, hit stack overflow character limit...]

    Read the article

  • Change TextView without completely re-drawing layout?

    - by twk
    I've found that updating a text view every second in my app burns a lot of CPU. The textview is in a horizontal LinearLayout, which is in turn inside of a vertical LinearLayout. Switching to a RelativeLayout (as recommended to increase perf) is not an option right now (I tried to get that working originally, but it was too complicated). The horizontal LinearLayout has 3 elements. The outer ones are TextViews with a layout_weight of 0, and the middle one is a progress bar with a layout_weight of 1 to make it expand to take up most of the space. I'm changing the contents of the leftmost TextView every second So, is there a way to change the contents of the text view without re-drawing everything? Or, can I force the TextViews to use a fixed amount of space to simplify the layout. Other tips for speeding up a LinearLayout are greatly appreciated as well. For reference, here is my entire layout. The field I'm updating is the timeIn one. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <TextView android:text="Artist Name" android:id="@+id/curArtist" android:textSize="8pt" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal" android:paddingTop="5dp"></TextView> <TextView android:text="Song Name" android:id="@+id/curSong" android:textSize="10pt" android:textStyle="bold" android:layout_below="@id/curArtist" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal"></TextView> <TextView android:text="Album Name" android:id="@+id/curAlbum" android:textSize="8pt" android:layout_below="@id/curSong" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center_horizontal"></TextView> <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/curAlbum" android:orientation="vertical"> <LinearLayout android:id="@+id/seekWrapper" android:layout_width="fill_parent" android:layout_height="wrap_content" android:minHeight="10dp" android:maxHeight="10dp" android:orientation="horizontal"> <TextView android:text="0:00" android:id="@+id/timeIn" android:textSize="4pt" android:paddingLeft="10dp" android:gravity="center_vertical" android:layout_weight="0" android:layout_gravity="left|center_vertical" android:layout_width="wrap_content" android:layout_height="fill_parent"></TextView> <ProgressBar android:layout_below="@id/curAlbum" android:id="@+id/progressBar" android:paddingLeft="7dp" android:paddingRight="7dp" android:layout_width="fill_parent" android:layout_height="fill_parent" android:maxHeight="10dp" android:minHeight="10dp" android:indeterminate="false" android:layout_weight="1" android:layout_gravity="center_horizontal|center_vertical" style="?android:attr/progressBarStyleHorizontal"></ProgressBar> <TextView android:text="0:00" android:id="@+id/timeLeft" android:paddingRight="10dp" android:textSize="4pt" android:layout_gravity="right|center_vertical" android:layout_weight="0" android:layout_width="wrap_content" android:layout_height="fill_parent"></TextView> </LinearLayout> <ImageView android:id="@+id/albumArt" android:layout_weight="1" android:padding="5dp" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/blank_album_art"></ImageView> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <ImageButton android:id="@+id/prev" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" android:src="@drawable/button_prev" android:paddingLeft="10dp" android:background="@null"></ImageButton> <ImageButton android:id="@+id/playPause" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" android:src="@drawable/button_play" android:layout_weight="1" android:background="@null"></ImageButton> <ImageButton android:id="@+id/next" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/button_next" android:layout_gravity="right" android:paddingRight="10dp" android:background="@null"></ImageButton> </LinearLayout> </LinearLayout> </RelativeLayout>

    Read the article

  • Custom RadioButton image not filling space

    - by Galip
    Hi guys, I have a custom radiobutton with a 9-patch image as background. I use a Selector to determine the background. I also have some text i want to put over the background of the image, but the text is aligning next to the button. This is the RadioGroup <LinearLayout android:id="@+id/segmented" android:layout_width="fill_parent" android:layout_height="50sp" android:gravity="center" android:layout_below="@+id/header"> <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/group1" android:gravity="center"> <RadioButton android:checked="false" android:layout_width="90sp" android:id="@+id/rbVerzekeringen" android:text="Verzekeringen" android:textSize="10sp" android:button="@drawable/checkbox_theme" /> <RadioButton android:checked="false" android:layout_width="90sp" android:id="@+id/rbPersoonlijk" android:text="Persoonlijk" android:textSize="10sp" android:button="@drawable/checkbox_theme" /> <RadioButton android:checked="false" android:layout_width="90sp" android:id="@+id/rbNotities" android:text="Notities" android:textSize="10sp" android:button="@drawable/checkbox_theme" /> </RadioGroup> </LinearLayout> This is the Selector: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="true" android:state_window_focused="false" android:drawable="@drawable/bt_filter_active" /> <item android:state_checked="false" android:state_window_focused="false" android:drawable="@drawable/bt_filter" /> <item android:state_checked="true" android:state_pressed="true" android:drawable="@drawable/bt_filter_active" /> <item android:state_checked="false" android:state_pressed="true" android:drawable="@drawable/bt_filter" /> <item android:state_checked="true" android:state_focused="true" android:drawable="@drawable/bt_filter_active" /> <item android:state_checked="false" android:state_focused="true" android:drawable="@drawable/bt_filter" /> <item android:state_checked="false" android:drawable="@drawable/bt_filter" /> <item android:state_checked="true" android:drawable="@drawable/bt_filter_active" /> </selector> And this is what it lookes like: As you can figure out I want 3 large buttons with the text over it. How can I do this? EDIT: I set the selector at background in stead of button and set the button to null. The code looks like this now: <LinearLayout android:id="@+id/segmented" android:layout_width="fill_parent" android:layout_height="50sp" android:gravity="center" android:layout_below="@+id/header"> <RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:id="@+id/group1" android:gravity="center"> <RadioButton android:checked="false" android:layout_width="100sp" android:layout_height="40sp" android:id="@+id/rbVerzekeringen" android:text="Verzekeringen" android:textSize="13sp" android:orientation="vertical" android:background="@drawable/checkbox_theme" android:button="@null" android:gravity="center"/> <RadioButton android:checked="false" android:layout_width="100sp" android:layout_height="35sp" android:id="@+id/rbPersoonlijk" android:text="Persoonlijk" android:textSize="35sp" android:background="@drawable/checkbox_theme" android:button="@null" android:gravity="center"/> <RadioButton android:checked="false" android:layout_width="100sp" android:layout_height="30sp" android:id="@+id/rbNotities" android:text="Notities" android:textSize="13sp" android:background="@drawable/checkbox_theme" android:button="@null" android:gravity="center"/> </RadioGroup> </LinearLayout> But now when I make the buttons larger or smaller the text in it just disappears like this (height of the first image is 40sp, the second is 35sp and the last one is 30sp): How can I make the background image smaller without cutting the text in it?

    Read the article

  • Can someone please help, I cant get this simple scolling feature

    - by localgamer
    I want to be able to have many button and objects in my project but they all wont fit on the screen at once so i would like the user to be able to scroll down and have more appear but i cant get it to work. I tried using ScrollView but it always throws me errors. Here is what I have so far. Please, any help would be great. <?xml version="1.0" encoding="utf-8"?> <AbsoluteLayout android:id="@+id/widget0" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Hello World, tipcalc" /> <TextView android:id="@+id/widget28" android:layout_width="99px" android:layout_height="17px" android:text="Monthly Income" android:layout_x="40px" android:layout_y="32px" > </TextView> <TextView android:id="@+id/widget29" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Cable" android:layout_x="40px" android:layout_y="82px" > </TextView> <TextView android:id="@+id/widget30" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Internet" android:layout_x="40px" android:layout_y="132px" > </TextView> <TextView android:id="@+id/widget33" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Total To Pay" android:layout_x="40px" android:layout_y="302px" > </TextView> <Button android:id="@+id/btncalculate" android:layout_width="87px" android:layout_height="wrap_content" android:text="Calculate" android:layout_x="40px" android:layout_y="182px" > </Button> <Button android:id="@+id/btnreset" android:layout_width="86px" android:layout_height="wrap_content" android:text="Reset" android:layout_x="140px" android:layout_y="182px" > </Button> <EditText android:id="@+id/Monthly" android:layout_width="wrap_content" android:layout_height="35px" android:text="100" android:textSize="18sp" android:layout_x="200px" android:layout_y="22px" > </EditText> <EditText android:id="@+id/Internet" android:layout_width="51px" android:layout_height="36px" android:text="10" android:textSize="18sp" android:layout_x="200px" android:layout_y="72px" > </EditText> <EditText android:id="@+id/Cable" android:layout_width="wrap_content" android:layout_height="39px" android:text="1" android:textSize="18sp" android:layout_x="200px" android:layout_y="122px" > </EditText> <TextView android:id="@+id/txttotal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="" android:layout_x="200px" android:layout_y="302px" > </TextView> </AbsoluteLayout>

    Read the article

  • ViewFliper in layout

    - by Surabhi Kale
    i am doing one application in android but i have one problem in layout file i am doing by viewFliper here is code <?xml version="1.0" encoding="utf-8"?> <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/Quesiontext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_marginTop="44dp" android:text="@string/Question" android:textSize="18sp" /> <RadioGroup android:id="@+id/radioGroupOptions" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_below="@+id/Quesiontext" android:layout_marginTop="30dp" > <RadioButton android:id="@+id/optionOne" android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="false" android:text="@string/option1" /> <RadioButton android:id="@+id/optionTwo" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/option2" /> <RadioButton android:id="@+id/optionthree" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/option3" /> <RadioButton android:id="@+id/optionFour" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/option4" /> </RadioGroup> <TextView android:id="@+id/corrertView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_below="@+id/radioGroupOptions" android:layout_marginRight="48dp" android:text="@string/correct" /> <Button android:id="@+id/btnNext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/corrertView" android:layout_below="@+id/corrertView" android:layout_marginTop="42dp" android:text="@string/Next" android:textSize="16sp" /> <Button android:id="@+id/Btnpervious" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignBaseline="@+id/btnNext" android:layout_alignBottom="@+id/btnNext" android:layout_alignParentLeft="true" android:text="@string/Pervious" android:textSize="16sp" /> <RelativeLayout android:id="@id/layout"//error android:layout_width="match_parent" android:layout_height="match_parent"> <ViewFlipper android:id="@+id/ViewFlipper01" android:layout_width="wrap_content" android:layout_height="wrap_content" > </RelativeLayout> </RelativeLayout> i didnt get it that how i put another button into ViewFliper ..its confusion and generating error...

    Read the article

  • EditText doesn't fill the whole height of the window

    - by user565447
    EditText doesn't fill the whole height of the window. Here is the code: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="vertical"> <LinearLayout android:id="@+id/LinearLayout02" android:layout_width="fill_parent" android:layout_height="wrap_content" android:orientation="horizontal" > <Button android:id="@+id/bItalic" android:layout_width="wrap_content" android:layout_height="wrap_content" ></Button> <Button android:id="@+id/bBold" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/bUnderline" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/bStrike" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="S" /> <Button android:id="@+id/bSub" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <Button android:id="@+id/bSup" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <ImageButton android:id="@+id/bInsertImage" android:src="@drawable/insertimage" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <ImageButton android:id="@+id/bInsertTable" android:src="@drawable/table" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </LinearLayout> <FrameLayout android:id="@+id/FrameLayout02" android:layout_height="fill_parent" android:layout_width="fill_parent" > <TabHost android:id="@+id/tabhost" android:layout_width="fill_parent" android:layout_height="fill_parent"> <TabWidget android:id="@android:id/tabs" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:paddingTop="62px"> <ScrollView android:id="@+id/scroll01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <HorizontalScrollView android:id="@+id/scroll_hor01" android:layout_width="fill_parent" android:layout_height="fill_parent"> <EditText android:id="@+id/VisualPane" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </HorizontalScrollView> </ScrollView> <ScrollView android:id="@+id/scroll02" android:layout_width="fill_parent" android:layout_height="fill_parent"> <HorizontalScrollView android:id="@+id/scroll_hor02" android:layout_width="fill_parent" android:layout_height="fill_parent"> <EditText android:id="@+id/HTMLPane" android:layout_width="fill_parent" android:layout_height="fill_parent" /> </HorizontalScrollView> </ScrollView> </FrameLayout> </TabHost> </FrameLayout> </LinearLayout> Here is a screenshot: Why doesn't EditText fill the whole height of the window?

    Read the article

  • RelativeLayout, ScrollView and navigation bar at bottom

    - by MicNeo
    What I want to do is, make layout like this: Title Date Long text with scrolling Navigation bar stick to the bottom Well I have done everything, however there is a little problem with scrolling. I want only to scroll text. Title and date should be stick to the top, and nav bar to the bottom of activity. And yes, it works, but my nav bar overlaps text :/ I tried everything, there is one solution I found, set fixed height for Scrollview, but this will not work on every devices well, isn't it? I probably could do some calculation in code, and on it change height, but I would like to stay in XML. Any one have any suggestions? Here is my XML file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:orientation="vertical" > <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.6" android:orientation="vertical" > <TextView android:id="@+id/feed_title" style="@style/h1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center_vertical" /> <TextView android:id="@+id/feed_info" style="@style/h2" android:layout_width="match_parent" android:layout_height="wrap_content" /> </LinearLayout> <ImageView android:id="@+id/feed_fav_ico" android:layout_width="50dp" android:layout_height="50dp" android:layout_alignParentRight="true" android:layout_gravity="center_vertical|right" android:background="@drawable/ic_fav_off" /> </LinearLayout> <ScrollView android:layout_width="fill_parent" android:layout_height="match_parent" android:fillViewport="true" android:scrollY="20dp" > <TextView android:id="@+id/feed_text" style="@style/text" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Loren ipsum full tekst" /> </ScrollView> </LinearLayout> <!-- Buttons --> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:background="#FFFFFF" android:orientation="vertical" android:paddingBottom="5dp" > <Button android:id="@+id/go_to_article" style="@style/button_screen" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_marginTop="15dp" android:text="@string/feed_show_full" /> <LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" > <Button android:id="@+id/next_feed" style="@style/button_screen" android:layout_width="40dp" android:layout_height="40dp" android:background="@drawable/button_arrow_up" /> <Button android:id="@+id/share_feed" style="@style/button_screen" android:layout_width="100dp" android:layout_height="40dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:text="@string/feed_share" /> <Button android:id="@+id/delete_feed" style="@style/button_screen" android:layout_width="100dp" android:layout_height="40dp" android:layout_marginLeft="5dp" android:layout_marginRight="5dp" android:text="@string/feed_delete" /> <Button android:id="@+id/prev_feed" android:layout_width="40dp" android:layout_height="40dp" android:background="@drawable/button_arrow_down" /> </LinearLayout> </LinearLayout> <!-- ~Buttons --> </RelativeLayout>

    Read the article

  • Couldn't get connection factory client - fighting with Google Maps

    - by iie
    another day another problem, I finally managed to set up correctly google maps on my android application, or at least I thought I've done it, the whole progam starts, it even call the class which should "print" a map, but the only thing I can see is a grid with google label on it [ in the corner ]. I've checked the dalvik monitor and the error E/MapActivity(394): Couldn't get connection factory client occurs. I've find out on stackoverflow website that I should sent a gps signal or sth like this from dalvik monitor, and I've done it. Nothing happend, also I got the api key one more time, but nothing changed. here is map.xml <?xml version="1.0" encoding="utf-8"?> <!-- This file is /res/layout/mapview.xml --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <Button android:id="@+id/zoomin" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+" android:onClick="myClickHandler" android:padding="12px" /> <Button android:id="@+id/zoomout" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="-" android:onClick="myClickHandler" android:padding="12px" /> <Button android:id="@+id/sat" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Satellite" android:onClick="myClickHandler" android:padding="8px" /> <Button android:id="@+id/street" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Street" android:onClick="myClickHandler" android:padding="8px" /> <Button android:id="@+id/traffic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Traffic" android:onClick="myClickHandler" android:padding="8px" /> <Button android:id="@+id/normal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Normal" android:onClick="myClickHandler" android:padding="8px" /> </LinearLayout> <com.google.android.maps.MapView android:id="@+id/mapview" android:layout_width="fill_parent" android:layout_height="wrap_content" android:clickable="true" android:apiKey="0zPcz1VYRSpLusufJ2JoL0ffl2uxDMovgpW319w" /> </LinearLayout> here is a MapMapa.java public class MapMapa extends MapActivity { private MapView mapView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.map); mapView = (MapView)findViewById(R.id.mapview); } public void myClickHandler(View target) { switch(target.getId()) { case R.id.zoomin: mapView.getController().zoomIn(); break; case R.id.zoomout: mapView.getController().zoomOut(); break; case R.id.sat: mapView.setSatellite(true); break; case R.id.street: mapView.setStreetView(true); break; case R.id.traffic: mapView.setTraffic(true); break; case R.id.normal: mapView.setSatellite(false); mapView.setStreetView(false); mapView.setTraffic(false); break; } } @Override protected boolean isLocationDisplayed() { return false; } @Override protected boolean isRouteDisplayed() { return false; } manifest.xml <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="menu.dot" android:versionCode="1" ndroid:versionName="1.0"> <application android:label="@string/app_name" android:icon="@drawable/icon"> <uses-library android:name="com.google.android.maps" /> <activity android:name="MainActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".About"> android:label="@string/about_title" android:theme="@android:style/Theme.Dialog" > </activity> <activity android:name=".Exit"> andorid:label="@string/exit_title"> </activity> <activity android:name=".Options"> </activity> <activity android:name=".Start"> </activity> <activity android:name=".Create"> </activity> <activity android:name=".Where"> </activity> <activity android:name=".Proceed"> </activity> <activity android:name=".Finish"> </activity> <activity android:name=".Login"> </activity> <activity android:name=".OK"> </activity> <activity android:name=".UserPanel"> </activity> <activity android:name=".Managero"> </activity> <activity android:name=".Edition"> </activity> <activity android:name=".Done"> </activity> <activity android:name=".Delete"> </activity> <activity android:name=".MapMapa"> </activity> </application> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/> <uses-permission android:name="android.permission.INTERNET"/> <uses-sdk android:minSdkVersion="3" /> </manifest>

    Read the article

  • screens goes up when soft keyboard came in front in And

    - by Sanat Pandey
    I have a question that, I want to take our Activity screen up when a softskeyboard came, in my app on Android Phone. I have used android:windowSoftInputMode="adjustResize|adjustPan" property in Android Manifest but nothing changed, problem remains same. Please suggest me for the right solution. Thanks in advance. XML: <?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#ffffff"> <FrameLayout android:id="@+id/frame" android:layout_gravity="top|bottom|center_horizontal" android:layout_width="wrap_content" android:layout_marginTop="10dip" android:layout_height="wrap_content"> <ImageView android:layout_gravity="center_horizontal" android:id="@+id/imageView1" android:src="@drawable/logo" android:layout_width="wrap_content" android:layout_marginTop="10dip" android:layout_height="78dp"></ImageView> </FrameLayout> <FrameLayout android:id="@+id/frameLayout1" android:layout_width="wrap_content" android:background="@drawable/login_box_bg" android:layout_gravity="center_horizontal" android:layout_marginTop="180dip" android:layout_height="wrap_content"> <EditText android:inputType="textEmailAddress" android:id="@+id/ed_Login_Email" android:background="@drawable/login_input_bg" android:layout_gravity="center_horizontal" android:layout_marginTop="10dip" android:layout_width="290dip" android:layout_height="40dip" android:hint="Email:" android:paddingLeft="10dp"> </EditText> <EditText android:background="@drawable/login_input_bg" android:layout_width="290dip" android:layout_gravity="center_horizontal" android:id="@+id/ed_Login_Pwd" android:inputType="textPassword" android:layout_marginTop="70dip" android:layout_height="40dip" android:hint="Password:" android:paddingLeft="10dip"> </EditText> <Button android:background="@drawable/login_btn_bg" android:id="@+id/btn_Login_Login" android:textColor="#ffffff" android:text="LOG IN" android:layout_gravity="bottom|center_horizontal" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_marginBottom="25dip"></Button> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/tv_Login_ForgotPwd" android:text="Forgot your password?" android:textColor="#000000" android:layout_gravity="bottom|center_horizontal" android:layout_marginBottom="10dip" android:clickable="true"></TextView> </FrameLayout> </FrameLayout>

    Read the article

  • Imageview in a listview - Height is bugged?

    - by Abdullah Gheith
    I am having a listview but i have problem i have the main.xml file, which contains a Listview: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/gradient" android:gravity="center" android:padding="1pt"> <ListView android:id="@+id/ListView01" android:layout_width="wrap_content" android:layout_height="fill_parent" android:background="@android:color/transparent" android:cacheColorHint="#00000000"/> </LinearLayout> Then, i have a custom listview file called listview.xml: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:background="@android:color/transparent" android:cacheColorHint="#00000000"> <TextView android:gravity="center" android:textColor="#ffffff" android:background="#0097D0" android:text="Overskrift" android:id="@+id/tvOverskrift" android:layout_width="fill_parent" android:layout_height="wrap_content" android:textStyle="bold" /> <ImageView android:id="@+id/ivBillede" android:scaleType="fitXY" android:padding="2px" android:gravity="fill" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/test"/> <TextView android:gravity="center" android:textColor="#ED2025" android:text="Dato" android:id="@+id/tvDato" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="normal"/> <TextView android:gravity="left" android:textColor="#000000" android:text="Indledning" android:id="@+id/tvIndledning" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="normal"/> </LinearLayout> the bitmap in the imagview i am getting is from a URL. By that code, i am getting is this: http://img585.imageshack.us/img585/5665/unavngivetv.png I am getting too much space in the height as you see

    Read the article

  • Circular Dependencies in XML file

    - by user3006081
    my android xml layout file keeps on Exception raised during rendering: Circular dependencies cannot exist in RelativeLayout Exception details are logged in Window Show View Error Log I cant figure out why? here is my code <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" tools:context="com.amandhapola.ribbit.LoginActivity" android:background="@drawable/background_fill" > <ImageView android:id="@+id/backgroundImage" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:scaleType="fitStart" android:src="@drawable/background" android:contentDescription="@string/content_desc_background"/> <TextView android:id="@+id/title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_above="@+id/subtitle" android:layout_centerHorizontal="true" android:textSize="60sp" android:layout_marginTop="32dp" android:textColor="@android:color/white" android:textStyle="bold" android:text="@string/app_name" /> <TextView android:id="@+id/subtitle" android:layout_centerHorizontal="true" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@+id/title" android:layout_above="@+id/usernameField" android:textSize="13sp" android:textColor="@android:color/white" android:textStyle="bold" android:text="@string/subtitle"/> <EditText android:id="@+id/usernameField" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_above="@+id/passwordField" android:layout_below="@+id/subtitle" android:layout_alignParentLeft="true" android:ems="10" android:hint="@string/username_hint" /> <EditText android:id="@+id/passwordField" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/usernameField" android:layout_above="@+id/loginButton" android:layout_alignParentLeft="true" android:layout_marginBottom="43dp" android:ems="10" android:hint="@string/password_hint" android:inputType="textPassword" /> <Button android:id="@+id/loginButton" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_below="@+id/passwordField" android:layout_above="@+id/signUpText" android:layout_alignParentLeft="true" android:text="@string/login_button_label" /> <TextView android:id="@+id/signUpText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" android:layout_centerHorizontal="true" android:textColor="@android:color/white" android:layout_below="@+id/loginButton" android:text="@string/sign_up_text" /> </RelativeLayout>

    Read the article

  • Gallery items become off-center when switching into landscape orientation.

    - by Sandile
    Hey Guys, Thanks for your time. I'm writing an application for android 2.2 and I'm using a gallery to circulate through a list of images that the user can then click to navigate other portions of the application. In portrait orientation, everything is kosher: the images are displaying correctly (completely in the center of the screen as I intended); however, in landscape orientation, all the images in the gallery are strangely displaced a fixed distance to the left of the center of the screen. I've been researching this issue for hours now and haven't found a solution. I'm hoping that some android guru can aid me in the resolution of this bizarre rendering issue. MainMenuActivity.java relevant code snippet (the activity in which the gallery resides) Gallery optionList = (Gallery)findViewById(R.id.mainMenuOptionList); GalleryItem[] optionListItemIdArray = new GalleryItem[] { new GalleryItem(R.drawable.icon_main_menu_option_list_blackboard, "Start Next Lesson", "Start the next planned vocab lesson."), new GalleryItem(R.drawable.icon_main_menu_option_list_index_cards, "Review Words", "Manually look over old words."), new GalleryItem(R.drawable.icon_main_menu_option_list_dice, "Play Vocab Games", "Play games to reinforce knowledge."), new GalleryItem(R.drawable.icon_main_menu_option_list_calendar, "View Lesson Plan", "View the schedule for coming lessons."), new GalleryItem(R.drawable.icon_main_menu_option_list_pie_chart, "View Performance Report", "Evaluate your overall performance statistics."), new GalleryItem(R.drawable.icon_main_menu_option_list_settings, "Manage Settings", "Change and modify application settings.") }; optionList.setAdapter(new GalleryImageAdapter(this, optionListItemIdArray)); NOTE: A GalleryItem is a POJO with an image resource id, title and description. GalleryImageAdapter.java: public class GalleryImageAdapter extends BaseAdapter { private Context context; private GalleryItem[] galleryItemArray; public GalleryImageAdapter(Context context, GalleryItem[] galleryItemArray) { this.context = context; this.galleryItemArray = galleryItemArray; } @Override public int getCount() { return galleryItemArray.length; } @Override public Object getItem(int position) { return position; } @Override public long getItemId(int position) { return position; } @Override public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView = new ImageView(context); imageView.setImageResource(galleryItemArray[position].getImageId()); imageView.setScaleType(ImageView.ScaleType.FIT_START); imageView.setLayoutParams(new Gallery.LayoutParams(Gallery.LayoutParams.WRAP_CONTENT, Gallery.LayoutParams.WRAP_CONTENT)); return imageView; } } Portrait version of main_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuLinearLayout" android:background="#3067a8" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dip" android:textColor="#ffffff" android:textSize="50sp" android:text="@string/main_menu_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuSubHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="15dip" android:textColor="#ffffff" android:textSize="15sp" android:text="@string/main_menu_sub_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionList" android:layout_width="fill_parent" android:layout_height="wrap_content" android:paddingTop="20dip" android:paddingBottom="10dip" android:spacing="40dip" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionListDetailLinearLayout" android:gravity="center_vertical|center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuOptionListLabelTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="25sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuOptionListDescriptionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="15sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> </LinearLayout> </LinearLayout> Landscape version of main_menu.xml <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuLinearLayout" android:background="#3067a8" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="10dip" android:textColor="#ffffff" android:textSize="50sp" android:text="@string/main_menu_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuSubHeadingTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingLeft="15dip" android:textColor="#ffffff" android:textSize="15sp" android:text="@string/main_menu_sub_heading" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionList" android:layout_width="fill_parent" android:layout_height="128dip" android:paddingLeft="0dip" android:paddingTop="5dip" android:spacing="10dip" /> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/mainMenuOptionListDetailLinearLayout" android:gravity="center_vertical|center_horizontal" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:id="@+id/mainMenuOptionListLabelTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="25sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> <TextView android:id="@+id/mainMenuOptionListDescriptionTextView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffff" android:textSize="15sp" android:shadowColor="#555555" android:shadowDx="0" android:shadowDy="0" android:shadowRadius="2" /> </LinearLayout> </LinearLayout> Thank you for your time!

    Read the article

  • Large margin by long title

    - by Kevin Koenen
    I try to show a list of offers. When an advertiser insert a large title, the margin of an item (offer) will be showed what shouldn't. I've tried different layouts but that doesn't work. Link to image :) You see, some of the items has a large margin. Here's the code: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallerylayout" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:gravity="left|center" android:layout_width="wrap_content" android:paddingBottom="2dp" android:paddingTop="2dp" android:paddingLeft="5dp" android:background="#20000000" android:cacheColorHint="#00000000"> <ImageView android:id="@+id/ad_image_small" android:layout_width="wrap_content" android:layout_height="fill_parent" android:layout_marginRight="6dip" android:src="@drawable/ic_launcher"/> <LinearLayout android:orientation="vertical" android:layout_width="0dip" android:layout_weight="1" android:layout_height="fill_parent"> <TextView android:id="@+id/ad_id" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:id="@+id/ad_img_url" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/ad_title" android:layout_width="wrap_content" android:layout_height="wrap_content" android:padding="3dp" android:gravity="left" android:textColor="#000000" android:ellipsize="end" android:singleLine="true"/> <TextView android:id="@+id/ad_km" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="3dp" android:layout_marginBottom="1dp" android:textColor="#000000" android:gravity="right"/> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content"> <TextView android:id="@+id/ad_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginLeft="3dp" android:textColor="#0099CC" android:ellipsize="end" android:singleLine="true"/> </LinearLayout> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_margin="2dp" android:padding="5dp"> <ImageView android:id="@+id/ad_clock" android:layout_width="20dp" android:layout_height="20dp" android:layout_marginRight="5dip" android:src="@drawable/icon_clock"/> <ProgressBar android:id="@+id/progressbar" android:layout_width="match_parent" android:layout_height="8dp" android:layout_margin="5dp" android:paddingLeft="2dp" android:max="100" style="?android:attr/progressBarStyleHorizontal" android:progressDrawable="@drawable/color_progressbar" /> </LinearLayout> </LinearLayout> </LinearLayout> <ImageView android:id="@+id/overlay_image" android:background="#0000" android:src="@drawable/verlopen2x" android:layout_alignTop="@id/ad_image_small" android:layout_alignBottom="@id/ad_image_small" android:layout_width="fill_parent" android:layout_height="wrap_content" android:adjustViewBounds="true" android:visibility="visible" /> I can't see what i'm doing wrong. Thanks in advance!

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >