android-xml

OnClick for navigationDrawer not loading new fragments

北城余情 提交于 2019-12-02 06:54:11
I have been trying to create a navigationDrawer for my project. I have been following this review here: http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/ I have been editing the code a bit, to use my own layout, in order to take out the icons and notifications in the navigation drawer. I just needed a simple one. I have the drawer mostly working except for the onCLicks. I am not getting any errors, but when I click an item in my NavDrawer it does not load the new fragment. I am not getting any error. Here is my code: MainDrawer2: public class MainDrawer2 extends

List View in Fragment not working

做~自己de王妃 提交于 2019-12-02 03:57:04
Heres my fragment code : public class LeftFragment extends ListFragment { ArrayList<String> data; public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.left_fragment, container, false); data = new ArrayList<String>(); data.add("1. dell"); data.add("2. samsung"); data.add("3. apple"); data.add("4. hp"); ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1, data); setListAdapter(adapter); return view; } and heres my xml for this fragment: <?xml version="1.0"

Android EditText hint uses the same font that the EditText has

非 Y 不嫁゛ 提交于 2019-12-02 00:32:44
问题 I have defined a font for a EditText and now the EditText hint also shows that font, but i need to use a different font for EditText hint, is there a way to achieve this? 回答1: Android EditText hint uses the same font that the EditText has EditText uses textview_hint layout to show ErrorPopup popup message.so try as to set different typeface for Hint as: LayoutInflater inflater = LayoutInflater.from(<Pass context here>); TextView hintTextView = (TextView) inflater.inflate( com.android.internal

Can't convert to dimension: type=0x1 when inflating the layout [duplicate]

吃可爱长大的小学妹 提交于 2019-12-02 00:26:51
This question already has an answer here: Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1 9 answers My XML file <?xml version="1.0" encoding="utf-8"?> <com.trill.trillapp.customviews.TrillSocialNetworkBar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/social_network" android:layout_width="match_parent" android:layout_height="@dimen/detail_social_network_bar_height" android:background="@color/color01"> <ImageView android:id="@+id/social_facebook_bt" android:layout_width="90dp" android:layout_height="match_parent" android:src=

Can't convert to dimension: type=0x1 when inflating the layout [duplicate]

别来无恙 提交于 2019-12-02 00:00:59
问题 This question already has answers here : Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1 (9 answers) Closed 2 months ago . My XML file <?xml version="1.0" encoding="utf-8"?> <com.trill.trillapp.customviews.TrillSocialNetworkBar xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/social_network" android:layout_width="match_parent" android:layout_height="@dimen/detail_social_network_bar_height" android:background="@color/color01">

media player play pause in android

淺唱寂寞╮ 提交于 2019-12-01 21:19:28
How can I make the Play and Pause image buttons look as a single image button. I am hereby attaching my code below. These are the images used. i Renamed play as start. import android.app.Activity; import android.media.MediaPlayer; import android.net.Uri; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ProgressBar; public class AudioView extends Activity{ MediaPlayer mp; Button p,pu,s,b,f,h,v,c,bu; ProgressBar myProgressBar; Uri uri=Uri.parse("http://player.trackitdown.net/preview/289245/preview_c-90-feat-red

ListView item with list_selector_background as LayerList drawable

时间秒杀一切 提交于 2019-12-01 19:22:53
If we use a ListView or an ExpandableListView the default background is @android:drawable/list_selector_background . I have an ExpandableListView which shows data grouped by date. I like the state list list_selector_background drawable and want to keep the behaviour for different states. But for the weekend (for some of the list view items) i'd like to define a custom background. But these items should still use the drawables for different states defined through list_selector_background. I saw different not suitable answers. Most of them say i should define my own state list drawable. The list

When are closing tags required with Android view markup?

陌路散爱 提交于 2019-12-01 18:00:51
问题 For some Android XML attributes, you don't conclude the opening tag with a '>' until after you've inserted your formatting components. For example: <EditText android:id="@+id/etEmails"> </EditText> Why is there no definition for the EditText component within the opening and closing tags? Also, I noticed that some don't even require closing tags and are just in themselves XML statements. For example: <Button android:text="Subtract 1" android:id="@+id/buttSub" /> Why does this XML statement not

When are closing tags required with Android view markup?

戏子无情 提交于 2019-12-01 17:44:57
For some Android XML attributes, you don't conclude the opening tag with a '>' until after you've inserted your formatting components. For example: <EditText android:id="@+id/etEmails"> </EditText> Why is there no definition for the EditText component within the opening and closing tags? Also, I noticed that some don't even require closing tags and are just in themselves XML statements. For example: <Button android:text="Subtract 1" android:id="@+id/buttSub" /> Why does this XML statement not require a closing statement when it practically provides the same components as the EditText field? Is

Android - rotate cuts off corners of shape

心已入冬 提交于 2019-12-01 16:37:30
I wish to make a diamond as a resource file so I am rotating a square in order to do so. The problem is that the corners seem to be getting cut off, making a hexagon instead. Also as a side note, I'd like to stretch it vertically if that's possible. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item> <rotate android:fromDegrees="45" android:pivotX="50%" android:pivotY="50%" android:toDegrees="45" > <shape android:shape="rectangle"> <size android:height="40dp" android:width="40dp" /> <solid android:color="@color/level_1_color" /> <