[Q] Android GestureOverlayView Drawerlayout xml - Android Q&A, Help & Troubleshooting

How can I use my gesture overlay view with navigation drawer? I'm adding the navigation drawer to the app with gesture overlay already working. I want to just add the swipe menu and if i have to give up the swipe gesture for the just have the action bar push button is fine. I just can't figure how to combine? I get an error before the app can start saying the it can't inflate class Drawer layout. See my XML code under.
Code:
<android.gesture.GestureOverlayView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/gestureOverlayView1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" >
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- The main content view -->
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- The navigation drawer -->
<ListView android:id="@+id/left_drawer"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="#666"
android:dividerHeight="1dp"
android:background="#333"
android:paddingLeft="15sp"
android:paddingRight="15sp"
/>
<LinearLayout
android:id="@+id/LinearLayout1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="10dp" >
<TextView
android:id="@+id/timerTextView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="5sp"
android:text="@string/startTime"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="30sp" />
<TextView
android:id="@+id/instructionTextView"
android:layout_width="574dp"
android:layout_height="wrap_content"
android:layout_weight="0.05"
android:textSize="40sp" />
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</android.gesture.GestureOverlayView>

Related

Align avatar pic on bottom of sent/received text (Mms.apk)

Hi! I'm modding my Mms.apk and I've added some speech bubbles etc. I want to place the avatar pic on the bottom of the layout, not on the top. I've tried diferent android:layout_gravity="bottom" but I haven't solved my problem...
Check the code please and tell me how to align avatar on bottom...
Code:
<?xml version="1.0" encoding="utf-8"?>
<com.android.mms.ui.MessageListItem android:orientation="horizontal" android:id="@id/msg_list_item_recv" android:background="#00000000" android:layout_width="fill_parent" android:layout_height="wrap_content"
xmlns:android="http://schemas.android.com/apk/res/android">
<LinearLayout android:orientation="vertical" android:id="@id/mms_layout_view_parent" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1.0">
<RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content">
<view android:id="@id/avatar" android:layout_width="@dimen/avatar_width_height" android:layout_height="@dimen/avatar_width_height" android:layout_alignParentLeft="true" class="com.android.mms.ui.QuickContactDivot" position="right_middle" android:layout_gravity="fill_vertical" android:layout_gravity="bottom"
xmlns:android="http://schemas.android.com/apk/res/android" />
<LinearLayout android:orientation="vertical" android:id="@id/message_block" android:background="@drawable/listitem_background" android:layout_width="wrap_content" android:layout_height="wrap_content" android:minHeight="@dimen/avatar_width_height" android:layout_toRightOf="@id/avatar" android:layout_alignParentRight="false">
<TextView android:textAppearance="?android:textAppearanceSmall" android:textSize="16.0sp" android:textColor="@android:color/black" android:autoLink="all" android:linksClickable="false" android:id="@id/text_view" android:paddingLeft="@dimen/message_item_text_padding_left_right" android:paddingTop="@dimen/message_item_text_padding_top" android:paddingRight="@dimen/message_item_text_padding_left_right" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<LinearLayout android:orientation="horizontal" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="8.0dip">
<TextView android:textAppearance="?android:textAppearanceSmall" android:textColor="#ff6f6f6f" android:id="@id/date_view" android:background="#00ffffff" android:paddingLeft="@dimen/message_item_text_padding_left_right" android:paddingRight="3.0dip" android:layout_width="wrap_content" android:layout_height="wrap_content" />
<ImageView android:id="@id/locked_indicator" android:paddingRight="3.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_lock_message_sms" />
<ImageView android:id="@id/delivered_indicator" android:paddingRight="3.0dip" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sms_mms_delivered" />
<ImageView android:id="@id/details_indicator" android:visibility="gone" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/ic_sms_mms_details" />
</LinearLayout>
<ViewStub android:id="@id/mms_layout_view_stub" android:layout="@layout/mms_layout_view" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</LinearLayout>
</RelativeLayout>
</LinearLayout>
<ViewStub android:layout_gravity="center_vertical" android:id="@id/mms_downloading_view_stub" android:layout="@layout/mms_downloading_view" android:layout_width="wrap_content" android:layout_height="wrap_content" />
</com.android.mms.ui.MessageListItem>
Please don't let this get lost in the forums.. I just need a dev to look at the code and tell me where I should put Android gravity to make avatar align on bottom.. Please
hi i also modifying.. that but i cant put it in the bottom
please help us to do this..
Sent from my MyPhone A848 Duo using XDA Premium 4 mobile app

Question regarding ImageView cropping / sizing and alignment in app widgets

Hi developers,
I have a special problem and didn't find a solution for it yet. So I hope that anybody here had a similar issue and can point me to a solution.
The problem:
Basically I use an ImageView inside my widgets. When the image is smaller than the ImageViews space then there is no problem.
The problem raises when the image gets bigger than the ImageView.
In some cases I want that the image doesn't get scaled but cropped and then aligned due to the users option.
What I want to achive is that the ImageView gets as big as the image and then is aligned (top, right, bottom, left). The rest of the image should get clipped by the container.
All I could achive until now is that the image gets cropped and centerd (all done by the ImageView).
Here is the xml I use for the widgets:
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mainLayout"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/widgetbackground"
android:focusable="true" >
<!-- [...] -->
<LinearLayout
android:id="@+id/llTextBlock"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:gravity="center"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/llText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<LinearLayout
android:id="@+id/llContent"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<!-- [...] -->
<ImageView
android:id="@+id/imgContentDontScale"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/widgetbackground"
android:focusable="true"
android:scaleType="center"
android:visibility="gone" >
</ImageView>
</LinearLayout>
<!-- [...] -->
</LinearLayout>
</LinearLayout>
<!-- [...] -->
</RelativeLayout>
The ImageView in question is the "imgContentDontScale" one.
The solution has to work on widgets (so almost only xml defined excluding the "RemotableViewMethod" marked methods) and ist has to be Froyo compatible.
Thanks
Michael

[Q] Need Help with an application and coding

I have created a new xml file in the res>layout forlder called tabs.xml. It has the following code:
<?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"
androidrientation="vertical" >
<TabHost
android:id="@android:id/tabhost"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
androidrientation="vertical" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
</TabWidget>
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<RelativeLayout
android:id="@+id/Network"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:text="Channel Type:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<RadioButton
android:id="@+id/urbanButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_below="@+id/textView1"
android:text="Urban" />
<RadioButton
android:id="@+id/suburbanButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/urbanButton1"
android:layout_alignBottom="@+id/urbanButton1"
android:layout_centerHorizontal="true"
android:text="SubUrban" />
<RadioButton
android:id="@+id/ruralButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBaseline="@+id/suburbanButton2"
android:layout_alignBottom="@+id/suburbanButton2"
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:text="Rural" />
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/urbanButton1"
android:text="Characteristics of Channel:"
android:textAppearance="?android:attr/textAppearanceMedium" />
<TextView
android:id="@+id/textView3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignRight="@+id/suburbanButton2"
android:layout_below="@+id/textView2"
android:text="Medium Text"
android:textAppearance="?android:attr/textAppearanceMedium" />
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView3"
android:layout_toLeftOf="@+id/ruralButton3"
android:text="Manual Override" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/power"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/Connectivity"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
<RelativeLayout
android:id="@+id/Offline"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</RelativeLayout>
</FrameLayout>
</LinearLayout>`enter code here`
</TabHost>
</LinearLayout>
Now i also have a andoid activity_main.xml in the same folder which i added nothing to it. i also created a java file called Tabs.Java and put it in the src folder under src>com.example.qosmetre>Tabs.Java with the following code
package com.example.qosmetre;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
public class Tabs extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tabs);
}
}
Now my question is, when i run my app on the terminal or in debugging mode, how come nothing is showing up but a blank screen? Like i want the tabs to show up first thing with all the stuff underneath them as shown in the code above. Also how would i import a library for scatter plotting data that would be in my app?
I need to know where and what files to put what code in because im just a beginner and i dont know too much so ill need big guidence.
Thanks again in advance.

Adding blue lines to notification screen, and have them disapear when not needed.

I am using the code below to insert a 1 pixel blue line a above and below the "Ongoing" and "Notification/Clear button" in the dropdown notification screen on Stock JB XWLSD, as in the screenshot 1.
Does anybody know if it is possiable to have the blue lines disapear when i press the clear button.
Currently when i press the clear button, the lines above and below the notification and clear button, merge into a 2 pixel blue line, as in screenshot 2.
And to make the blue lines disappear when i unplug my phone from my computer
When i unplug my phone from my computer, the blue lines above and below the ongoing, merge into a 2 pixel blue line, as in screenshot 3
And when my phone is unpluged and there are no notifications, all of the blue lines merge into a 4 pixel line at the top of the notification section, as in screenshot 4.
Is there a way to remove these blue lines when the are not being used by ongoing and notifications.
Or is there another code i can use to get the blue lines that i want, and to have theme dissapear when they are not needed.
Any help would be greatly appreciated.
Code:
[COLOR=Red]<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ff33b5e5" />[/COLOR]
<LinearLayout android:orientation="vertical" android:id="@id/onGoingCart" android:background="#00000000" android:focusable="true" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
<TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="#ff33b5e5" android:gravity="left|center" android:id="@id/onGoingNotificationText" android:paddingLeft="11.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="@string/status_bar_ongoing_events_title" />
</LinearLayout>
[COLOR=Red]<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ff33b5e5" />[/COLOR]
<com.android.systemui.statusbar.policy.NotificationRowLayout android:background="#00000000" android:id="@id/onGoingItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
[COLOR=Red]<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ff33b5e5" />[/COLOR]
<LinearLayout android:orientation="vertical" android:id="@id/notificationCart" android:background="#00000000" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/status_bar_expanded_notification_category_height">
<RelativeLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="wrap_content">
<TextView android:textSize="@dimen/status_bar_expanded_notification_category_text_size" android:textColor="#ff33b5e5" android:gravity="left|center" android:id="@id/latestNotificationText" android:paddingLeft="11.0dip" android:layout_width="180.0dip" android:layout_height="fill_parent" android:text="@string/status_bar_latest_events_title" android:layout_alignParentLeft="true" />
<TextView android:textSize="@dimen/status_bar_expanded_notification_clear_button_text_size" android:textColor="#ff33b5e5" android:gravity="center" android:id="@id/clear_all_button" android:background="@drawable/tw_btn_default_small" android:padding="0.100000024dip" android:focusable="true" android:clickable="true" android:layout_width="@dimen/status_bar_expanded_clear_button_width" android:layout_height="fill_parent" android:layout_marginRight="4.0dip" android:text="@string/status_bar_clear_all_button" android:layout_alignParentRight="true" android:contentDescription="@string/accessibility_clear_all" />
</RelativeLayout>
</LinearLayout>
[COLOR=Red]<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="#ff33b5e5" />[/COLOR]
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/notificationItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
<com.android.systemui.statusbar.policy.NotificationRowLayout android:id="@id/latestItems" android:layout_width="fill_parent" android:layout_height="wrap_content" systemui:rowHeight="@dimen/tw_notification_row_min_height" />
</LinearLayout>

Deformin self images for ToggleButton

Hi dear developers,
I spend much time with this issue.
When I create LinearLayout with four ToggleButtons with self images, button image will not keep aspect ratio, images will be deformed.
Button images pressed in vertical, not in horizontal.
This is layout code with deformed images:
<LinearLayout
android:id="@+id/linearLayout4"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0px"
androidrientation="horizontal">
<ToggleButton
android:id="@+id/bt1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT1"
android:textOn="BT1" />
<ToggleButton
android:id="@+id/bt2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT2"
android:textOn="BT2" />
<ToggleButton
android:id="@+id/bt3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT3"
android:textOn="BT3" />
<ToggleButton
android:id="@+id/bt"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/led"
android:text="Led"
android:textOff="BT4"
android:textOn="BT4" />
</LinearLayout>
When I create similar LinearLayout with four ImageViews instead of ToggleButtons with same images, images not will be deformed. Same images keep aspect ratio. Button images pressed in vertical and horizontal with same ratio.
<LinearLayout
android:id="@+id/linearLayout3"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0px"
androidrientation="horizontal">
<ImageView
android:id="@+id/img1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
<ImageView
android:id="@+id/img2"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
<ImageView
android:id="@+id/img3"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
<ImageView
android:id="@+id/img4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:src="@drawable/led" />
</LinearLayout>
I don't know, why it's behavior different. Size of image is 128 x 128 pixels in png file.
How I can reach that ToggleButton's image will keep aspect ratio for all relative sizes?
Application is compiled in Android Studio 3.6.1 with build gradle:
...
android {
compileSdkVersion 25
buildToolsVersion '28.0.3'
defaultConfig {
applicationId "com.nabto.androidaudiodemo"
minSdkVersion 11
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
...
Thank you for your help
Srapur

Categories

Resources