android-xml

TextViews do not align correctly in RelativeLayout

大城市里の小女人 提交于 2019-12-11 14:50:29
问题 I have a textview (uploaderTv) which should be lined up below titleTv with viewCountTv to the right of it. The problem is the titleTv sometimes overlaps into a second line - and causes an overlap with the text below it (look below the word Rihanna - you can barely see the uploaderTv textView). Screenshot: XML: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/linearLayout" android:layout_width="match_parent

Place buttons half in one layout parent and half in another

懵懂的女人 提交于 2019-12-11 14:49:14
问题 I have the following layout, it works fine and gives me the result. The result I want is to divide the screen into two parts and place buttons half in each part: <RelativeLayout android:layout_width="match_parent" android:layout_height="200dp" > <LinearLayout 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_weight="1" > <RelativeLayout

Android custom view attributes - 'color' as attribute name disallowed

喜你入骨 提交于 2019-12-11 13:52:45
问题 I've made a simple custom view, a "ColorSwatch". It's circular, shows the assigned color and if that color has transparency, the color is drawn atop a checker pattern. The view works fine. My problem is that when I define the custom attributes for the swatch (in values/attrs_color_swatch_view.xml ), I can't specify an attribute named "color". The compiler complains that color is already defined, and points me to my colors.xml file. As a workaround, I called the parameter swatchColor , but I'd

Skipped 32 frames! The application may be doing too much work on its main thread and then FATAL EXCEPTION: main

折月煮酒 提交于 2019-12-11 10:48:50
问题 I am new to android programming. I am developing an android app. DashboardGridActivity is a main activity. This activity should show grid view on launching of this app. Following are files from my app: DashboardGridActivity: public class DashboardGridActivity extends Activity { GridView myDashboard; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_dashboard_grid); myDashboard = (GridView)findViewById(R.id

ActionBarSherlock mirrod attributes — when to use “android:” prefix?

独自空忆成欢 提交于 2019-12-11 10:08:48
问题 When styling ActionBarSherlock I was wondering when I have to use the prefixed attribute, when the non-prefixed attribute, and when both. For example: <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item> <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item> I found this explanation on the ActionBarSherlock website: Mirrored Attributes Due to limitations in Android's theming system any theme customizations must be declared in two attributes. The normal android

How can I make this code for Animations more effective?

折月煮酒 提交于 2019-12-11 08:23:48
问题 This code switches the y-position of two Views (mView1 and mView2) on Button click via ObjectAnimator and AnimationSet s. While the translate animation the alpha value of both views will be reduced and growth again. This is just a setup to play around a bit. The alpha animation is defined in XML and the translate animation is done with code. <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" android:ordering="sequentially"> <objectAnimator

Android Resouce by ID / Change image onClick / no change of imageView

无人久伴 提交于 2019-12-11 07:04:12
问题 I have a problem with my imageview not changing after picking an image from an array (xml resource), but falling back into the default value. Content of my MeasurementActivity.java public class MeasurementActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_measurement); getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); final ImageView imageViewMeasurement =

Why is my custom layout file not recognized?

两盒软妹~` 提交于 2019-12-11 04:35:58
问题 I created a file in \res\layout named contactlist.xml But it is not recognized in my code: SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, //android.R.layout.simple_list_item_1, mContacts, //if cre8 own layout, replace "simple_[etc]" //android.R.layout.simple_list_item_checked, mContacts, // or simple_list_item_multiple_choice //android.R.layout.simple_list_item_multiple_choice, mContacts, android.R.layout.contactlist, mContacts, // <- contact list ist xml-non-grata new String[]

getTheme().applyStyle(…) multiple times without overwriting the previous one

橙三吉。 提交于 2019-12-11 04:23:08
问题 When I apply extra attributes to the AppTheme multiple times it overwrites the previous one. This is the code I am using: MainActivity: @Override protected void onCreate(@Nullable Bundle savedInstanceState) { getTheme().applyStyle(R.style.AppTheme_OverlayPrimaryRed); // If you change `false` to `true`, the overlay above is overwritten. if (false) { getTheme().applyStyle(R.style.AppTheme_OverlayAccentRed); } super.onCreate(savedInstanceState); ... } AppTheme.OverlayPrimaryRed: <style name=

Open Activity with Linkify Android

自古美人都是妖i 提交于 2019-12-11 03:38:08
问题 i want to open Activity when users click on textView with linkify... Heres my code: Pattern tagMatcher = Pattern.Compile("#([A-Za-z0-9_-]+)"); //Scheme for Linkify, when a word matched tagMatcher pattern, //that word is appended to this URL and used as content URI String newActivityURL = "content://Solution.Project.WelcomeActivity"; //Attach Linkify to TextView wrapper.Text.Text = post.PostText; Linkify.AddLinks(wrapper.Text, tagMatcher, newActivityURL); and my Android manifest.xml