android-xml

Android: how to create shape with skewed two-tone color?

房东的猫 提交于 2019-12-12 02:31:42
问题 I am attempting to create a drawable shape that will become the background of a search bar. I know how to create a rectangle with two colors but I do not know how to tilt the color at an angle, like in the second image. Can someone help me with this? Thanks. 回答1: Take a Toolbar...code is here... <android.support.v7.widget.Toolbar android:layout_width="500dp" android:layout_height="wrap_content" android:background="@drawable/custom_background" /> create a drawable res file custom_background

How to allow user to drag and drop an image within a LinearLayout

本小妞迷上赌 提交于 2019-12-12 01:05:00
问题 I have a LinearLayout set up which has an image within it. My XML layout: <LinearLayout android:id="@+id/llColorSpect" android:layout_width="match_parent" android:layout_height="@dimen/color_scheme_height" android:orientation="vertical" android:background="@drawable/colorspect" android:layout_marginRight="@dimen/activity_horizontal_margin" android:layout_marginLeft="@dimen/activity_horizontal_margin" android:layout_marginBottom="@dimen/seek_bar_margin" android:layout_below="@+id/tvBGColor" >

Add Prefrences Screen to an Activity with a customized window title

自古美人都是妖i 提交于 2019-12-12 01:03:50
问题 I know its possible to add a button to a prefernces Screeen activtiy. I read this question How to add a button to PreferenceScreen and it works perfect. But if I want to add my custom title my application just crashes. The customtitle works perfect in its own activity and the preference screen with button works also perfect in its own activity. So my problem is only based on bringing these two functions together. heres my code in of the java file public class TestHeadlineActivity extends

Android RelativeLayout with wrap_content truncates some children

。_饼干妹妹 提交于 2019-12-12 00:35:25
问题 I have a RelativeLayout whose width/height is set to wrap_content. However, the button in the bottom right is truncated on its lower side. Changing the RelativeLayout's paddingBottom doesn't help, neither does adding a marginBottom to the button. Any ideas? Here's my code: <RelativeLayout android:id="@+id/sign_up_phase_enteraddress" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:paddingTop="10dp" android:paddingRight="10dp"

How to change a list item rendering according to its content?

天大地大妈咪最大 提交于 2019-12-12 00:32:32
问题 I am using a ListFragment with a CursorAdapter to display a list of items. The XML layout is pretty simple: it only consists of the title, a description and the number of comments. Instead, I would like to show the number of comments on the right side . If it is possible I would like to add an image or a colored box as a background frame . Further, I would like to change the image/color according to the number of comments . This is the layout file I am currently using. <?xml version="1.0"

XmlResourceParser.getText() returning null

元气小坏坏 提交于 2019-12-12 00:25:47
问题 I have an XmlResourceParser instance called xml . When I try to call getText() on a node, as seen in my code, it returns null. This is strange because I can call getName() on the same node it returns the proper value, so the instance is set up properly. Here is my code: XmlResourceParser xml = context.getResources().getXml(R.xml.thesaurus); try { //if (xml.getName().equals("word")) { xml.next(); //to the first node within <word></word> boolean notFound = true; while (notFound) { xml.next();

Change color of action bar shadow gradient

99封情书 提交于 2019-12-12 00:18:24
问题 I'd like to change the color of the shadow gradient that appears at the bottom of the Action Bar . I'm using ActionBarSherlock . I've looked through the XML resources trying to determine where this shape is defined but I'm feeling a bit overwhelmed. Can somebody point me in the right direction? 回答1: I've looked through the XML resources trying to determine where this shape is defined They are not defined as XML shapes. The ActionBar/ABS uses 9Patches. You can use the ActionBar Style generator

How to manipulate the Activity's Options Menu

元气小坏坏 提交于 2019-12-11 19:23:46
问题 I've Googled and come up with no code on how to manipulate what the settings button does, or what is brought up when the settings touch button on the phone is pressed. Here is a screenshot of what I mean: At the bottom, you can see that it says settings, but when I click on it, nothing happens. I want to change what happens when it is clicked. Also, I want to be able to change what is brought up (the settings option in the screenshot is what's brought up) when the settings button on the

Animation in RelativeLayout to slide down

让人想犯罪 __ 提交于 2019-12-11 17:52:23
问题 I need help to animate a RelativeLayout. The next image explain how is my aplication: Now, when I touch a marker of a map, it displays a RelativeLayout (call Marker Title in the picture) and the animation to slide up works well, however, my code to slide down doesn't work well because it get down from top of the screen. My code is this: This is the code where it hides the RelativeLayout: public void hideSlideUp() { RelativeLayout slideLayout; slideLayout = (RelativeLayout) findViewById(R.id

Android layout correct alignment

╄→гoц情女王★ 提交于 2019-12-11 16:23:16
问题 I am working on a project and I have run into some problems. I haven't worked with the layouts very much so I don't know if this is possible or not. In the picture I have added the project mock-up. For the lower screen resolution it looks fine, but when I put the app on 5 inch device, this orange area is too high and I wanted to know if it is possible somehow to get that area centered. The orange area is a LinearLayout and everything is wrapped inside LinearLayout. Hope you understand what I